7
7
:appearance =" appearance"
8
8
>
9
9
<SocialAuth
10
- v-if =" isSignView "
10
+ v-if =" authView === VIEWS.SIGN_IN || authView === VIEWS.SIGN_UP "
11
11
:supabaseClient =" supabaseClient"
12
12
:appearance =" appearance"
13
13
:providers =" providers"
20
20
/>
21
21
<template v-if =" ! onlyThirdPartyProviders " >
22
22
<EmailAuth
23
- v-if =" authView === 'sign_in' || authView === 'sign_up' "
23
+ v-if =" authView === VIEWS.SIGN_IN || authView === VIEWS.SIGN_UP "
24
24
:supabaseClient =" supabaseClient"
25
25
:appearance =" appearance"
26
26
:redirectTo =" redirectTo"
30
30
:additionalData =" additionalData"
31
31
/>
32
32
<MagicLink
33
- v-if =" authView === 'magic_link' "
33
+ v-if =" authView === VIEWS.MAGIC_LINK "
34
34
:supabaseClient =" supabaseClient"
35
35
:appearance =" appearance"
36
36
:redirectTo =" redirectTo"
41
41
</SocialAuthContainer >
42
42
<template v-else >
43
43
<ForgottenPassword
44
- v-if =" authView === 'forgotten_password' "
44
+ v-if =" authView === VIEWS.FORGOTTEN_PASSWORD "
45
45
:supabaseClient =" supabaseClient"
46
46
:appearance =" appearance"
47
47
:redirectTo =" redirectTo"
48
48
:showLinks =" showLinks"
49
49
:i18n =" i18n"
50
50
/>
51
51
<UpdatePassword
52
- v-if =" authView === 'update_password' "
52
+ v-if =" authView === VIEWS.UPDATE_PASSWORD "
53
53
:supabaseClient =" supabaseClient"
54
54
:appearance =" appearance"
55
55
:i18n =" i18n"
56
56
/>
57
57
<VerifyOtp
58
- v-if =" authView === 'verify_otp' "
58
+ v-if =" authView === VIEWS.VERIFY_OTP "
59
59
:supabaseClient =" supabaseClient"
60
60
:appearance =" appearance"
61
61
:otpType =" otpType"
62
62
:i18n =" i18n"
63
63
/>
64
64
<AnonymousAuth
65
- v-if =" authView === 'anonymous_sign_in' "
65
+ v-if =" authView === VIEWS.ANONYMOUS_SIGN_IN "
66
66
:supabaseClient =" supabaseClient"
67
67
:appearance =" appearance"
68
68
:i18n =" i18n"
73
73
74
74
<script lang="ts" setup>
75
75
import { provide , ref , watch , computed } from ' vue'
76
- import { I18nVariables , en , merge } from ' @supabase/auth-ui-shared'
76
+ import { I18nVariables , en , merge , VIEWS } from ' @supabase/auth-ui-shared'
77
77
import { createStitches } from ' @stitches/core'
78
78
import cloneDeep from ' lodash.clonedeep'
79
79
import { colord } from ' colord'
@@ -92,7 +92,7 @@ import VerifyOtp from './VerifyOtp.vue'
92
92
import AnonymousAuth from ' ./AnonymousAuth.vue'
93
93
94
94
const props = withDefaults (defineProps <AuthProps >(), {
95
- view: ' sign_in ' ,
95
+ view: VIEWS . SIGN_IN ,
96
96
socialLayout: ' vertical' ,
97
97
onlyThirdPartyProviders: false ,
98
98
magicLink: false ,
@@ -131,9 +131,9 @@ const i18n = computed<I18nVariables>(() => {
131
131
*/
132
132
const isSignView = computed (() => {
133
133
return (
134
- authView .value === ' sign_in ' ||
135
- authView .value === ' sign_up ' ||
136
- authView .value === ' magic_link '
134
+ authView .value === VIEWS . SIGN_IN ||
135
+ authView .value === VIEWS . SIGN_UP ||
136
+ authView .value === VIEWS . MAGIC_LINK
137
137
)
138
138
})
139
139
@@ -177,9 +177,9 @@ watch(
177
177
const { data : authListener } = props .supabaseClient .auth .onAuthStateChange (
178
178
(event ) => {
179
179
if (event === ' PASSWORD_RECOVERY' ) {
180
- setAuthView (' update_password ' )
180
+ setAuthView (VIEWS . UPDATE_PASSWORD )
181
181
} else if (event === ' USER_UPDATED' ) {
182
- setAuthView (' sign_in ' )
182
+ setAuthView (VIEWS . SIGN_IN )
183
183
}
184
184
}
185
185
)
0 commit comments