cookie util

This commit is contained in:
Alexander Bocken 2023-07-18 14:20:50 +02:00
parent 7dd52d8890
commit f714ef3fa6
Signed by: Alexander
GPG Key ID: 1D237BE83F9B05E8

11
src/utils/cookie.js Normal file
View File

@ -0,0 +1,11 @@
// utils/cookie.js
export function getJWTFromRequest(request) {
const cookies = request.headers.get("cookie") || '';
const jwtCookie = cookies.split(';').find(cookie => cookie.trim().startsWith('UserSession='));
if (jwtCookie) {
return jwtCookie.split('=')[1] || '';
}
return '';
}