refactor(pages): update login page

navigate to the home page after successful login
This commit is contained in:
parent d38c217a58
commit 6a35c4affc
Signed by: tablet
GPG Key ID: 924A5F6AF051E87C

@ -10,6 +10,7 @@
unauthenticatedOnly: true,
navigateAuthenticatedTo: "/",
},
middleware: ["auth"],
});
const formState = reactive<FormState>({
@ -23,6 +24,10 @@
let reso: any;
try {
reso = await signIn(values);
await navigateTo({
path: "/",
});
} catch (e: any) {
if (e.data) {
notification["error"]({
@ -30,24 +35,20 @@
});
}
}
await navigateTo({
path: "/",
});
};
</script>
<template>
<a-form :model="formState" name="basic" :label-col="{ span: 8 }" autocomplete="off" :colon="false" layout="vertical" @finish="onFinish">
<a-form-item label="Username" name="username" :rules="[{ required: true, message: 'Username required!' }]">
<a-input v-model:value="formState.username" />
<a-input data-testid="login.username" v-model:value="formState.username" />
</a-form-item>
<a-form-item :colon="false" label="Password" name="password" :rules="[{ required: true, message: 'Password required!' }]">
<a-input-password v-model:value="formState.password" />
<a-input-password data-testid="login.password" v-model:value="formState.password" />
</a-form-item>
<a-form-item>
<a-row :justify="'center'" :align="'middle'">
<a-col>
<a-button type="primary" html-type="submit">Log in</a-button>
<a-button data-testid="login.submit" type="primary" html-type="submit">Log in</a-button>
</a-col>
</a-row>
</a-form-item>