Files
classroomio/apps/dashboard/src/lib/utils/functions/cookies.ts
T
Rotimi Best 3919ff6c2f Enhance audience management features with new components and API integrations
- Added `AssignCoursesModal`, `AudienceMemberRow`, `AudienceTable`, and related components for improved audience management UI.
- Implemented audience invite actions including resend and revoke functionality.
- Updated audience API to support importing members and assigning courses.
- Refactored audience data handling to include status and invite management.
- Improved overall user experience with pagination and selection features in the audience table.
2026-03-22 18:42:23 +01:00

25 lines
789 B
TypeScript

import type { Cookies } from '@sveltejs/kit';
/**
* Returns the classroomio cookie string for API/auth requests.
* Filters cookies whose names include "classroomio" and joins them as `name=value; ...`.
*/
export function getCioCookieString(cookies: Cookies): string {
return cookies
.getAll()
.filter((c) => c.name.includes('classroomio'))
.map((c) => `${c.name}=${c.value}`)
.join('; ');
}
export function getHasCioCookies(cookies: Cookies): boolean {
const cioCookies = cookies.getAll().filter((c) => c.name.includes('classroomio'));
if (cioCookies.length === 0) return false;
// check if the cookies doesn't includ ONLY classroomio_locale
const onlyLocaleCookie = cioCookies.every((c) => c.name === 'classroomio_locale');
return !onlyLocaleCookie;
}