show auth modal in case of redirect
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
import { addNote, setActiveNote, rootNote } from '@/composables/useNotes'
|
||||
import { user, signOut as firebaseSignOut } from '@/composables/useFirebase'
|
||||
import { initialized } from '@/composables/useFirebase'
|
||||
import firebase from 'firebase/compat/app'
|
||||
import * as firebaseui from 'firebaseui'
|
||||
|
||||
const props = defineProps<{
|
||||
sideBarCollapsed: boolean
|
||||
@@ -15,6 +17,12 @@ const signOut = async (close: () => Promise<boolean>) => {
|
||||
await firebaseSignOut()
|
||||
close()
|
||||
}
|
||||
|
||||
const authModalInitialStateOpen = ref(
|
||||
(
|
||||
firebaseui.auth.AuthUI.getInstance() || new firebaseui.auth.AuthUI(firebase.auth())
|
||||
).isPendingRedirect()
|
||||
)
|
||||
</script>
|
||||
<template>
|
||||
<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]" />
|
||||
</button>
|
||||
<Modal v-if="initialized && !user">
|
||||
<Modal v-if="initialized && !user" :open="authModalInitialStateOpen">
|
||||
<template #activator="{ open }">
|
||||
<button class="btn-outline btn-sm btn py-1 text-white" @click="open">Sign in</button>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user