fix login
This commit is contained in:
parent
4254368597
commit
3f1b833c82
1 changed files with 2 additions and 2 deletions
|
@ -1,4 +1,4 @@
|
|||
import { redirect } from '@sveltejs/kit';
|
||||
import { HttpError, redirect } from '@sveltejs/kit';
|
||||
import type { Actions, PageServerLoad } from './$types';
|
||||
import { APIError } from '$lib/api/request';
|
||||
import { getLoggedInUser, login, logout } from '$lib/api/auth';
|
||||
|
@ -28,7 +28,6 @@ export const actions = {
|
|||
|
||||
try {
|
||||
await login(cookies, username, password);
|
||||
throw redirect(302, url.searchParams.get('then') || '/admin');
|
||||
} catch (e) {
|
||||
if (e instanceof APIError) {
|
||||
switch (e.code) {
|
||||
|
@ -38,6 +37,7 @@ export const actions = {
|
|||
}
|
||||
return { error: 'unknown internal error' };
|
||||
}
|
||||
throw redirect(302, url.searchParams.get('then') || '/admin');
|
||||
},
|
||||
logout: async ({ url, cookies }) => {
|
||||
await logout(cookies);
|
||||
|
|
Loading…
Reference in a new issue