changed functions for nuxt-friendly version

This commit is contained in:
2026-01-21 18:28:26 +00:00
parent 048bcd1b5a
commit 501580b2e0
4 changed files with 18 additions and 22 deletions

View File

@@ -39,20 +39,17 @@ const schema = z.object({
type Schema = z.output<typeof schema>
function onSubmit(payload: FormSubmitEvent<Schema>) {
return fetch(base_url + "/login", {
return $fetch("/login", {
method: "POST",
headers: {
"Content-Type" : "application/json"
},
body: JSON.stringify({
body: {
email: payload.data.email,
password: payload.data.password,
remember: payload.data.remember || false
})
}).then((response) => {
if (response.ok)
window.location.href = "/";
else if (response.status == 401) {
}
}).then((r) => {
reloadNuxtApp({path: "/"});
}).catch((err) => {
if(err.data.statusCode == 401) {
wrong_login.value = true;
// show for 5 seconds
setTimeout(() => wrong_login.value = false, 5000);