fix: fix redirect on auth

This commit is contained in:
Théo 2023-09-20 13:12:16 +02:00
parent c3c1d4bf22
commit 9e43d220d7
4 changed files with 8 additions and 21 deletions

View file

@ -46,7 +46,9 @@ export const actions = {
path: '/'
});
throw redirect(303, '/dashboard');
return {
form
};
}
form.errors.passwd = ["Nom d'utilisateur ou mot de passe incorrect"];

View file

@ -10,17 +10,7 @@
export let data: PageData;
const { form, errors, enhance } = superForm(data.form, {
onResult({ result }) {
switch (result.type) {
case 'redirect':
goto(result.location, {
replaceState: true
});
break;
}
}
});
const { form, errors, enhance } = superForm(data.form);
</script>
<div class="flex h-screen w-full">

View file

@ -125,7 +125,9 @@ export const actions = {
path: '/'
});
throw redirect(303, '/dashboard');
return {
form
};
}
if (res.status === 400) {

View file

@ -1,9 +1,7 @@
<script lang="ts">
import { goto } from '$app/navigation';
import { fade } from 'svelte/transition';
import { superForm } from 'sveltekit-superforms/client';
import type { PageData, Snapshot } from './$types';
import Button from '$lib/components/ui/Button.svelte';
@ -20,11 +18,6 @@
case 'error':
confirmation = false;
break;
case 'redirect':
goto(result.location, {
replaceState: true
});
break;
}
}
});