Align admin, community, search, library, learning and course management with the mockup. Add saved courses, download history, public community feed, instructor directory, backend search, course views, admin content tools and community moderation. Harden API and Nginx for production.
18 lines
489 B
TypeScript
18 lines
489 B
TypeScript
// Per-viewer UI preferences (theme, sidebar). Storage can be unavailable in
|
|
// private windows, so every access is guarded and falls back to the default.
|
|
export const readPreference = (key: string): string | null => {
|
|
try {
|
|
return window.localStorage.getItem(key);
|
|
} catch {
|
|
return null;
|
|
}
|
|
};
|
|
|
|
export const writePreference = (key: string, value: string) => {
|
|
try {
|
|
window.localStorage.setItem(key, value);
|
|
} catch {
|
|
// Preference simply isn't remembered.
|
|
}
|
|
};
|