TXAVLOG
Deploy DPTXA to Hugging Face Spaces
4bea261
Raw
History Blame Contribute Delete
651 Bytes
export const GET = async ({ cookies }) => {
const token = cookies.get('auth_token')?.value;
if (!token) {
return new Response(JSON.stringify({ user: null }), {
status: 200,
headers: { 'Content-Type': 'application/json' }
});
}
try {
const userData = JSON.parse(Buffer.from(token, 'base64').toString('utf-8'));
return new Response(JSON.stringify({ user: userData }), {
status: 200,
headers: { 'Content-Type': 'application/json' }
});
} catch (err) {
return new Response(JSON.stringify({ user: null }), {
status: 200,
headers: { 'Content-Type': 'application/json' }
});
}
};