2026-01-25 16:15:25 +05:30
|
|
|
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 });
|
|
|
|
|
});
|
2026-01-25 16:15:25 +05:30
|
|
|
|
|
|
|
|
// 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 });
|
2026-01-25 16:15:25 +05:30
|
|
|
});
|