feat(front-nuxt): [WIP] login

This commit is contained in:
2025-11-01 21:30:24 +01:00
parent 6be93d915e
commit 695342e19a
3 changed files with 21 additions and 10 deletions

View File

@@ -0,0 +1,13 @@
<script setup lang="ts">
const props = defineProps<{
onSubmitAction: (credentials: {
username: string;
password: string;
}) => boolean;
}>();
async function onSubmit() {}
</script>
<template>
<form @onsubmit="onSubmit">Test form</form>
</template>

View File

@@ -34,11 +34,12 @@ export default defineNuxtRouteMiddleware((to, from) => {
// else just redirect to login
return navigateTo(LOGIN_ROUTE);
}
return;
} else {
return navigateTo(LOGIN_ROUTE);
}
} catch (e) {
console.error(">> [!] Not in client");
console.error(">> [!] Not in client", e);
}
console.log(">> Global Middleware from ", from.path);

View File

@@ -6,21 +6,18 @@ definePageMeta({
const userStore = useUserStore();
const setUpUser = () => {
userStore.update({
id: "1",
name: "My name",
roles: ["user", "manager"],
});
// userStore.setUser({
// id: "1",
// name: "My name",
// roles: ["user", "manager"],
// });
};
</script>
<template>
<div>
Login form
<div>
User profile:
{{ userStore.profile }}
</div>
<AuthLoginForm />
<button @click="setUpUser">Login</button>
</div>
</template>