feat: just getting better and better
This commit is contained in:
@@ -145,14 +145,20 @@
|
||||
const props = defineProps({
|
||||
returnUrl: {
|
||||
type: String,
|
||||
default: '/landing',
|
||||
default: '/app/dashboard',
|
||||
},
|
||||
});
|
||||
|
||||
function getPostLoginUrl() {
|
||||
return props.returnUrl?.startsWith('/app')
|
||||
? props.returnUrl
|
||||
: '/app/dashboard';
|
||||
}
|
||||
|
||||
async function handleLocalLogin() {
|
||||
try {
|
||||
await authStore.login(email.value, password.value);
|
||||
await router.push(props.returnUrl);
|
||||
await router.push(getPostLoginUrl());
|
||||
} catch (error) {
|
||||
console.error('Login failed:', error);
|
||||
errorSnackBar.value = true;
|
||||
@@ -163,7 +169,7 @@
|
||||
try {
|
||||
const response = await authStore.loginWithGoogle(JSON.stringify(token));
|
||||
if (response === true) {
|
||||
await router.push(props.returnUrl);
|
||||
await router.push(getPostLoginUrl());
|
||||
} else {
|
||||
errorSnackBar.value = true;
|
||||
}
|
||||
@@ -177,7 +183,7 @@
|
||||
try {
|
||||
const response = await loginWithFacebook();
|
||||
if (response === true) {
|
||||
await router.push(props.returnUrl);
|
||||
await router.push(getPostLoginUrl());
|
||||
} else {
|
||||
errorSnackBar.value = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user