show auth modal in case of redirect
This commit is contained in:
@@ -2,6 +2,8 @@
|
|||||||
import { addNote, setActiveNote, rootNote } from '@/composables/useNotes'
|
import { addNote, setActiveNote, rootNote } from '@/composables/useNotes'
|
||||||
import { user, signOut as firebaseSignOut } from '@/composables/useFirebase'
|
import { user, signOut as firebaseSignOut } from '@/composables/useFirebase'
|
||||||
import { initialized } from '@/composables/useFirebase'
|
import { initialized } from '@/composables/useFirebase'
|
||||||
|
import firebase from 'firebase/compat/app'
|
||||||
|
import * as firebaseui from 'firebaseui'
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
sideBarCollapsed: boolean
|
sideBarCollapsed: boolean
|
||||||
@@ -15,6 +17,12 @@ const signOut = async (close: () => Promise<boolean>) => {
|
|||||||
await firebaseSignOut()
|
await firebaseSignOut()
|
||||||
close()
|
close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const authModalInitialStateOpen = ref(
|
||||||
|
(
|
||||||
|
firebaseui.auth.AuthUI.getInstance() || new firebaseui.auth.AuthUI(firebase.auth())
|
||||||
|
).isPendingRedirect()
|
||||||
|
)
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div class="fixed left-0 right-0 top-0 z-[500] flex h-[50px] bg-primary">
|
<div class="fixed left-0 right-0 top-0 z-[500] flex h-[50px] bg-primary">
|
||||||
@@ -38,7 +46,7 @@ const signOut = async (close: () => Promise<boolean>) => {
|
|||||||
>
|
>
|
||||||
<i class="fas fa-plus-circle text-[1.1rem]" />
|
<i class="fas fa-plus-circle text-[1.1rem]" />
|
||||||
</button>
|
</button>
|
||||||
<Modal v-if="initialized && !user">
|
<Modal v-if="initialized && !user" :open="authModalInitialStateOpen">
|
||||||
<template #activator="{ open }">
|
<template #activator="{ open }">
|
||||||
<button class="btn-outline btn-sm btn py-1 text-white" @click="open">Sign in</button>
|
<button class="btn-outline btn-sm btn py-1 text-white" @click="open">Sign in</button>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Reference in New Issue
Block a user