diff options
Diffstat (limited to 'src/routes/(app)/disable2fa/+server.js')
| -rw-r--r-- | src/routes/(app)/disable2fa/+server.js | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/routes/(app)/disable2fa/+server.js b/src/routes/(app)/disable2fa/+server.js index 237da445..13fcb2b9 100644 --- a/src/routes/(app)/disable2fa/+server.js +++ b/src/routes/(app)/disable2fa/+server.js @@ -1,8 +1,13 @@ +import { error } from '@sveltejs/kit'; import { auth, post } from '$lib/utils'; -export async function PUT({ cookies, request }) { - let body = await request.json(); - let res = await post('/disable2fa', body, auth(cookies)); +export async function POST({ cookies, request }) { + try { + let body = await request.json(); + let res = await post('/disable2fa', body, auth(cookies)); - return new Response(JSON.stringify(res)); + return new Response(JSON.stringify(res)); + } catch (e) { + throw error(500, 'Problem disabling 2fa'); + } } |
