@zedux/stores
Version:
The legacy composable store model of Zedux
30 lines (29 loc) • 677 B
JavaScript
export const prefix = '@@zedux';
/**
* IMPORTANT! Keep these in sync with `@zedux/atoms/utils/general.ts`
*/
export const Invalidate = 1;
export const Destroy = 2;
export const PromiseChange = 3;
export const EventSent = 4;
export const getErrorPromiseState = (error) => ({
error,
isError: true,
isLoading: false,
isSuccess: false,
status: 'error',
});
export const getInitialPromiseState = (data) => ({
data,
isError: false,
isLoading: true,
isSuccess: false,
status: 'loading',
});
export const getSuccessPromiseState = (data) => ({
data,
isError: false,
isLoading: false,
isSuccess: true,
status: 'success',
});