mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-21 18:13:55 +00:00
26 lines
526 B
TypeScript
26 lines
526 B
TypeScript
import { createSlice } from "@reduxjs/toolkit";
|
|
import type { PayloadAction } from "@reduxjs/toolkit";
|
|
|
|
interface SearchState {
|
|
value: string;
|
|
}
|
|
|
|
const initialState: SearchState = {
|
|
value: "",
|
|
};
|
|
|
|
export const searchSlice = createSlice({
|
|
name: "search",
|
|
initialState,
|
|
reducers: {
|
|
setSearch: (state, action: PayloadAction<string>) => {
|
|
state.value = action.payload;
|
|
},
|
|
clearSearch: (state) => {
|
|
state.value = "";
|
|
},
|
|
},
|
|
});
|
|
|
|
export const { setSearch, clearSearch } = searchSlice.actions;
|