Enhance signin flow: add toast notifications for error handling and update background color variable
This commit is contained in:
1 parent
2b368cede4
commit
ce44cd03b9
4 files changed
+10
-2
No files matched your search
@@ -1,4 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
|
<ToastContainer />
|
||||||
<NuxtLayout>
|
<NuxtLayout>
|
||||||
<NuxtPage />
|
<NuxtPage />
|
||||||
</NuxtLayout>
|
</NuxtLayout>
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ export const useAuth = () => {
|
|||||||
)
|
)
|
||||||
|
|
||||||
refreshToken.value = res.data.refreshToken
|
refreshToken.value = res.data.refreshToken
|
||||||
|
|
||||||
|
await navigateTo("/")
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (axios.isAxiosError(e) && e.response?.data?.message) {
|
if (axios.isAxiosError(e) && e.response?.data?.message) {
|
||||||
throw new Error(e.response.data.message)
|
throw new Error(e.response.data.message)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const auth = useAuth()
|
const auth = useAuth()
|
||||||
|
const toast = useToast()
|
||||||
|
|
||||||
const submit = async (e: any) => {
|
const submit = async (e: any) => {
|
||||||
let data: any
|
let data: any
|
||||||
@@ -8,7 +9,11 @@ const submit = async (e: any) => {
|
|||||||
data = Object.fromEntries(new FormData(e?.target as HTMLFormElement))
|
data = Object.fromEntries(new FormData(e?.target as HTMLFormElement))
|
||||||
} catch {}
|
} catch {}
|
||||||
|
|
||||||
await auth.signin(data.email, data.password, data.remember)
|
try {
|
||||||
|
await auth.signin(data.email, data.password, data.remember)
|
||||||
|
} catch (e: string | any) {
|
||||||
|
toast.show(e, "error")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
$color-accent: rgb(255, 69, 58);
|
$color-accent: rgb(255, 69, 58);
|
||||||
$color-background: #1a202c;
|
$color-background: oklch(14.1% 0.005 285.823); // #1a202c
|
||||||
$color-text: rgba(255, 255, 255, 0.92);
|
$color-text: rgba(255, 255, 255, 0.92);
|
||||||
$color-placeholder-text: rgba(255, 255, 255, 0.44);
|
$color-placeholder-text: rgba(255, 255, 255, 0.44);
|
||||||
$color-border: rgba(255, 255, 255, 0.16);
|
$color-border: rgba(255, 255, 255, 0.16);
|
||||||
|
|||||||
Reference in new issue
Block a user