77 :appearance =" appearance"
88 >
99 <SocialAuth
10- v-if =" isSignView "
10+ v-if =" authView === VIEWS.SIGN_IN || authView === VIEWS.SIGN_UP "
1111 :supabaseClient =" supabaseClient"
1212 :appearance =" appearance"
1313 :providers =" providers"
2020 />
2121 <template v-if =" ! onlyThirdPartyProviders " >
2222 <EmailAuth
23- v-if =" authView === 'sign_in' || authView === 'sign_up' "
23+ v-if =" authView === VIEWS.SIGN_IN || authView === VIEWS.SIGN_UP "
2424 :supabaseClient =" supabaseClient"
2525 :appearance =" appearance"
2626 :redirectTo =" redirectTo"
3030 :additionalData =" additionalData"
3131 />
3232 <MagicLink
33- v-if =" authView === 'magic_link' "
33+ v-if =" authView === VIEWS.MAGIC_LINK "
3434 :supabaseClient =" supabaseClient"
3535 :appearance =" appearance"
3636 :redirectTo =" redirectTo"
4141 </SocialAuthContainer >
4242 <template v-else >
4343 <ForgottenPassword
44- v-if =" authView === 'forgotten_password' "
44+ v-if =" authView === VIEWS.FORGOTTEN_PASSWORD "
4545 :supabaseClient =" supabaseClient"
4646 :appearance =" appearance"
4747 :redirectTo =" redirectTo"
4848 :showLinks =" showLinks"
4949 :i18n =" i18n"
5050 />
5151 <UpdatePassword
52- v-if =" authView === 'update_password' "
52+ v-if =" authView === VIEWS.UPDATE_PASSWORD "
5353 :supabaseClient =" supabaseClient"
5454 :appearance =" appearance"
5555 :i18n =" i18n"
5656 />
5757 <VerifyOtp
58- v-if =" authView === 'verify_otp' "
58+ v-if =" authView === VIEWS.VERIFY_OTP "
5959 :supabaseClient =" supabaseClient"
6060 :appearance =" appearance"
6161 :otpType =" otpType"
6262 :i18n =" i18n"
6363 />
6464 <AnonymousAuth
65- v-if =" authView === 'anonymous_sign_in' "
65+ v-if =" authView === VIEWS.ANONYMOUS_SIGN_IN "
6666 :supabaseClient =" supabaseClient"
6767 :appearance =" appearance"
6868 :i18n =" i18n"
7373
7474<script lang="ts" setup>
7575import { 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'
7777import { createStitches } from ' @stitches/core'
7878import cloneDeep from ' lodash.clonedeep'
7979import { colord } from ' colord'
@@ -92,7 +92,7 @@ import VerifyOtp from './VerifyOtp.vue'
9292import AnonymousAuth from ' ./AnonymousAuth.vue'
9393
9494const props = withDefaults (defineProps <AuthProps >(), {
95- view: ' sign_in ' ,
95+ view: VIEWS . SIGN_IN ,
9696 socialLayout: ' vertical' ,
9797 onlyThirdPartyProviders: false ,
9898 magicLink: false ,
@@ -131,9 +131,9 @@ const i18n = computed<I18nVariables>(() => {
131131 */
132132const isSignView = computed (() => {
133133 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
137137 )
138138})
139139
@@ -177,9 +177,9 @@ watch(
177177 const { data : authListener } = props .supabaseClient .auth .onAuthStateChange (
178178 (event ) => {
179179 if (event === ' PASSWORD_RECOVERY' ) {
180- setAuthView (' update_password ' )
180+ setAuthView (VIEWS . UPDATE_PASSWORD )
181181 } else if (event === ' USER_UPDATED' ) {
182- setAuthView (' sign_in ' )
182+ setAuthView (VIEWS . SIGN_IN )
183183 }
184184 }
185185 )
0 commit comments