fehlerbehebung
This commit is contained in:
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user