refactor(pages): move auth pages to auth subdirectory

i.e., /login, /register, /logout
This commit is contained in:
parent 3415f41044
commit 1c69ad6c2c
Signed by: tablet
GPG Key ID: 924A5F6AF051E87C
5 changed files with 14 additions and 9 deletions

@ -16,7 +16,7 @@
messages: "/messages", messages: "/messages",
profile: `/user/${data?.value?.user?._id || 0}`, profile: `/user/${data?.value?.user?._id || 0}`,
admin: "/admin", admin: "/admin",
logout: "/logout", logout: "/auth/logout",
}); });
let cur = ref<string>( let cur = ref<string>(
Object.keys(itemMap.value).find( Object.keys(itemMap.value).find(
@ -80,13 +80,13 @@
</a-button> </a-button>
</div> </div>
<div class="acbut" v-if="!data"> <div class="acbut" v-if="!data">
<a-button size="large" @click="() => navigateTo('/login')"> <a-button size="large" @click="() => navigateTo('/auth/login')">
Login Login
</a-button> </a-button>
<a-button <a-button
size="large" size="large"
type="primary" type="primary"
@click="() => navigateTo('/register')" @click="() => navigateTo('/auth/register')"
> >
Register Register
</a-button> </a-button>

@ -52,7 +52,7 @@ export default defineNuxtConfig({
provider: { provider: {
type: "local", type: "local",
pages: { pages: {
login: "/login", login: "/auth/login",
}, },
token: { token: {
signInResponseTokenPointer: "/token", signInResponseTokenPointer: "/token",
@ -156,4 +156,9 @@ export default defineNuxtConfig({
// components: { // components: {
// transform: (str) => // transform: (str) =>
// }, // },
typescript: {
tsConfig: {
exclude: ["./.nuxt/types/auth.d.ts"],
},
},
}); });

@ -1,6 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import { ref, reactive } from "vue"; import { ref, reactive } from "vue";
import useApiFetch from "../composables/useApiFetch"; import useApiFetch from "../../composables/useApiFetch";
import { notification } from "ant-design-vue"; import { notification } from "ant-design-vue";
interface FormState { interface FormState {
username: string; username: string;

@ -80,7 +80,7 @@
}, },
}); });
onVerify((resp) => { onVerify((resp) => {
// log.debug("onverify called", resp); console.debug("onverify called", resp);
srv(resp); srv(resp);
}); });
const onFinish = handleSubmit(async (values: any, actions: any) => { const onFinish = handleSubmit(async (values: any, actions: any) => {
@ -123,7 +123,7 @@ notification[ "error" ]({
<a-form-item <a-form-item
label="Username" label="Username"
:name="field.name" :name="field.name"
:validate-status="!!errorMessage ? 'error' : undefined" :validate-status="!!errorMessage ? 'error' : ''"
:help="errorMessage" :help="errorMessage"
> >
<a-input v-bind="field" v-model:value="field.value" /> <a-input v-bind="field" v-model:value="field.value" />
@ -133,7 +133,7 @@ notification[ "error" ]({
<a-form-item <a-form-item
label="Email address" label="Email address"
:name="field.name" :name="field.name"
:validate-status="!!errorMessage ? 'error' : undefined" :validate-status="!!errorMessage ? 'error' : ''"
:help="errorMessage" :help="errorMessage"
> >
<a-input v-bind="field" v-model:value="field.value" /> <a-input v-bind="field" v-model:value="field.value" />
@ -143,7 +143,7 @@ notification[ "error" ]({
<a-form-item <a-form-item
label="Password" label="Password"
:name="field.name" :name="field.name"
:validate-status="!!errorMessage ? 'error' : undefined" :validate-status="!!errorMessage ? 'error' : ''"
:help="errorMessage" :help="errorMessage"
> >
<a-input-password v-bind="field" v-model:value="field.value" /> <a-input-password v-bind="field" v-model:value="field.value" />