SurfSense/surfsense_web/atoms/ui/loading.atoms.ts

20 lines
483 B
TypeScript
Raw Normal View History

import { atom } from "jotai";
interface GlobalLoadingState {
isLoading: boolean;
}
export const globalLoadingAtom = atom<GlobalLoadingState>({
isLoading: false,
});
// Helper atom for showing global loading
2026-01-27 15:28:30 +05:30
export const showGlobalLoadingAtom = atom(null, (get, set) => {
set(globalLoadingAtom, { isLoading: true });
});
// Helper atom for hiding global loading
export const hideGlobalLoadingAtom = atom(null, (get, set) => {
2026-01-27 15:28:30 +05:30
set(globalLoadingAtom, { isLoading: false });
});