fix: fix redirect on auth
This commit is contained in:
parent
c3c1d4bf22
commit
9e43d220d7
4 changed files with 8 additions and 21 deletions
|
@ -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"];
|
||||
|
|
|
@ -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">
|
||||
|
|
|
@ -125,7 +125,9 @@ export const actions = {
|
|||
path: '/'
|
||||
});
|
||||
|
||||
throw redirect(303, '/dashboard');
|
||||
return {
|
||||
form
|
||||
};
|
||||
}
|
||||
|
||||
if (res.status === 400) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue