replace alerts with notifications using DaisyUI toasts
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
const supabase = useSupabaseAuthClient();
|
||||
const config = useRuntimeConfig();
|
||||
const notifyStore = useNotifyStore();
|
||||
|
||||
const loading = ref(false)
|
||||
const email = ref('')
|
||||
@@ -12,9 +13,9 @@
|
||||
redirectTo: `${config.public.siteRootUrl}/resetpassword`,
|
||||
})
|
||||
if (error) throw error
|
||||
else alert('Password Reset link sent, check your email.');
|
||||
else notifyStore.notify("Password Reset link sent, check your email.", NotificationType.Success);
|
||||
} catch (error) {
|
||||
alert(error)
|
||||
notifyStore.notify(error, NotificationType.Error);
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
const supabase = useSupabaseAuthClient();
|
||||
|
||||
const notifyStore = useNotifyStore();
|
||||
|
||||
const loading = ref(false)
|
||||
const password = ref('')
|
||||
const confirmPassword = ref('')
|
||||
@@ -13,11 +15,11 @@
|
||||
});
|
||||
if (error) throw error
|
||||
else {
|
||||
alert('password changed');
|
||||
notifyStore.notify("password changed", NotificationType.Success);
|
||||
navigateTo('/signin', {replace: true}); // navigate to signin because it is best practice although the auth session seems to be valid so it immediately redirects to dashboard
|
||||
}
|
||||
} catch (error) {
|
||||
alert(error)
|
||||
notifyStore.notify(error, NotificationType.Error);
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
const supabase = useSupabaseAuthClient();
|
||||
|
||||
const accountStore = useAccountStore()
|
||||
const notifyStore = useNotifyStore();
|
||||
|
||||
const loading = ref(false)
|
||||
const email = ref('')
|
||||
@@ -15,7 +16,7 @@
|
||||
const { error } = await supabase.auth.signInWithPassword({ email: email.value, password: password.value })
|
||||
if (error) throw error
|
||||
} catch (error) {
|
||||
alert(error)
|
||||
notifyStore.notify(error, NotificationType.Error);
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
@@ -28,7 +29,7 @@
|
||||
const { error } = await supabase.auth.signInWithOAuth({ provider: 'google' })
|
||||
if (error) throw error
|
||||
} catch (error) {
|
||||
alert(error)
|
||||
notifyStore.notify(error, NotificationType.Error);
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
const user = useSupabaseUser()
|
||||
const supabase = useSupabaseAuthClient();
|
||||
|
||||
const notifyStore = useNotifyStore();
|
||||
|
||||
const loading = ref(false)
|
||||
const email = ref('')
|
||||
const password = ref('')
|
||||
@@ -19,7 +21,7 @@
|
||||
signUpOk.value = true;
|
||||
}
|
||||
} catch (error) {
|
||||
alert(error)
|
||||
notifyStore.notify(error, NotificationType.Error);
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user