Spaces:
Sleeping
Sleeping
| 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' } | |
| }); | |
| } | |
| }; | |