Files
yaak/src-web/hooks/useCookieJars.ts
2025-01-02 08:33:04 -08:00

13 lines
364 B
TypeScript

import type { CookieJar } from '@yaakapp-internal/models';
import { atom, useAtomValue } from 'jotai';
export const cookieJarsAtom = atom<CookieJar[] | undefined>();
export const sortedCookieJars = atom((get) =>
get(cookieJarsAtom)?.sort((a, b) => a.name.localeCompare(b.name)),
);
export function useCookieJars() {
return useAtomValue(sortedCookieJars);
}