fehlerbehebung

This commit is contained in:
titver968
2025-01-16 12:30:07 +01:00
parent 2829c39843
commit 47e2da580b

View File

@@ -1,15 +1,18 @@
import { error } from '@sveltejs/kit'; import { error } from '@sveltejs/kit';
import { json } from '@sveltejs/kit'; import { json } from '@sveltejs/kit';
//import { verify } from 'jsonwebtoken'; //
// import { verify } from 'jsonwebtoken';
import jwt from 'jsonwebtoken'; const { sign, verify } = jwt; import jwt from 'jsonwebtoken'; const { sign, verify } = jwt;
export function GET({ request }) { export function GET({ request }) {
const authorization = request.headers.get('authorization'); const authorization = request.headers.get('authorization');
try { try {
// @ts-ignore
const jwt = authorization.slice(7); const jwt = authorization.slice(7);
const decoded = verify(jwt, 'shhhhh'); const decoded = verify(jwt, 'shhhhh');
return json(decoded); return json(decoded);
} catch (err) { } catch (err) {
error(404, { message: err.message }); //error(404, { message: err.message });
console.log(err);
} }
} }