Refactor New Ui Sosial, Keamanan, & Bantuan
This commit is contained in:
30
src/store/sosial.ts
Normal file
30
src/store/sosial.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { proxy } from "valtio";
|
||||
|
||||
type SelectedYear = string;
|
||||
|
||||
interface SosialState {
|
||||
selectedYear: SelectedYear;
|
||||
filters: {
|
||||
dusun: string | null;
|
||||
kategori: string | null;
|
||||
};
|
||||
}
|
||||
|
||||
export const sosialStore = proxy<SosialState>({
|
||||
selectedYear: new Date().getFullYear().toString(),
|
||||
filters: {
|
||||
dusun: null,
|
||||
kategori: null,
|
||||
},
|
||||
});
|
||||
|
||||
export const setYear = (year: SelectedYear) => {
|
||||
sosialStore.selectedYear = year;
|
||||
};
|
||||
|
||||
export const setFilter = (
|
||||
key: keyof SosialState["filters"],
|
||||
value: string | null,
|
||||
) => {
|
||||
sosialStore.filters[key] = value;
|
||||
};
|
||||
Reference in New Issue
Block a user