import { error } from '@sveltejs/kit';
import { json } from '@sveltejs/kit';
//
// import { verify } from 'jsonwebtoken';
import jwt from 'jsonwebtoken';
const { sign, verify } = jwt;

export function GET({ request }) {
	const authorization = request.headers.get('authorization');
	try {
		// @ts-ignore
		const jwt = authorization.slice(7);
		const decoded = verify(jwt, 'shhhhh');
		return json(decoded);
	} catch (err) {
		//error(404, { message: err.message });
		console.log(err);
	}
}
