Skip to content
This repository was archived by the owner on Dec 22, 2022. It is now read-only.

Commit 1cc0483

Browse files
committed
redirect to account page on successful login
1 parent ab41ec2 commit 1cc0483

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pages/account/login.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { useCustomer } from '@/stores'
77
const email = ref('')
88
const password = ref('')
99
const canLogin = computed(() => email.value && password.value)
10+
const isSignedIn = computed(() => useCustomer().isSignedIn)
1011
const loginErrors = computed(() => useCustomer().customerUserErrors)
1112
1213
const submitLogin = () => {
@@ -18,6 +19,11 @@ onMounted(() => {
1819
const createdEmailParam = useRoute().params.email
1920
createdEmailParam ? typeof createdEmailParam === 'string' ? email.value = createdEmailParam : email.value = createdEmailParam[0] : false
2021
})
22+
watch([isSignedIn], () => {
23+
if (isSignedIn.value) {
24+
navigateTo({ name: 'account' })
25+
}
26+
})
2127
</script>
2228

2329
<template>

0 commit comments

Comments
 (0)