mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-24 15:25:46 +00:00
refactor(FE): Move table slice into UI store and persist search
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import { StateCreator } from 'zustand';
|
||||
|
||||
export interface TableState {
|
||||
searchValue: string;
|
||||
}
|
||||
|
||||
export interface TableUISlice {
|
||||
searchValue: string;
|
||||
setSearchValue: (value: string) => void;
|
||||
resetSearchValue: () => void;
|
||||
}
|
||||
|
||||
export const createTableUISlice: StateCreator<
|
||||
TableUISlice,
|
||||
[],
|
||||
[],
|
||||
TableUISlice
|
||||
> = (set) => ({
|
||||
// Initial state
|
||||
searchValue: '',
|
||||
|
||||
// Actions
|
||||
setSearchValue: (value) => set({ searchValue: value }),
|
||||
|
||||
resetSearchValue: () => {
|
||||
return set({ searchValue: '' });
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user