Refactor New Ui Bumdes
This commit is contained in:
30
src/store/umkm.ts
Normal file
30
src/store/umkm.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { proxy } from "valtio";
|
||||
|
||||
type TimeRange = "minggu" | "bulan";
|
||||
|
||||
interface UmkmState {
|
||||
selectedRange: TimeRange;
|
||||
filters: {
|
||||
kategori: string | null;
|
||||
umkm: string | null;
|
||||
};
|
||||
}
|
||||
|
||||
export const umkmStore = proxy<UmkmState>({
|
||||
selectedRange: "bulan",
|
||||
filters: {
|
||||
kategori: null,
|
||||
umkm: null,
|
||||
},
|
||||
});
|
||||
|
||||
export const setRange = (range: TimeRange) => {
|
||||
umkmStore.selectedRange = range;
|
||||
};
|
||||
|
||||
export const setFilter = (
|
||||
key: keyof UmkmState["filters"],
|
||||
value: string | null,
|
||||
) => {
|
||||
umkmStore.filters[key] = value;
|
||||
};
|
||||
Reference in New Issue
Block a user