Fixed 12 type errors by adding proper type annotations: Quick Wins Completed: - do_on_key.js: Added JSDoc types for KeyboardEvent and function parameters - randomize.js: Added JSDoc types with generic template for array shuffling - cookie.js: Added JSDoc types for Request API - stripHtmlTags.ts: Added TypeScript types for string parameter Progress: 12/1239 errors fixed (Quick Wins - Category 1 partial) Created TODO_cleanup.md to track remaining 1227 type errors systematically.
18 lines
388 B
JavaScript
18 lines
388 B
JavaScript
// utils/cookie.js
|
|
|
|
/**
|
|
* @param {Request} request
|
|
* @returns {string}
|
|
*/
|
|
export function getJWTFromRequest(request) {
|
|
const cookies = request.headers.get("cookie") || '';
|
|
/** @param {string} cookie */
|
|
const jwtCookie = cookies.split(';').find(cookie => cookie.trim().startsWith('UserSession='));
|
|
|
|
if (jwtCookie) {
|
|
return jwtCookie.split('=')[1] || '';
|
|
}
|
|
|
|
return '';
|
|
}
|