mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-18 16:53:57 +00:00
25 lines
511 B
TypeScript
25 lines
511 B
TypeScript
import { createSlice } from "@reduxjs/toolkit";
|
|
import type { PayloadAction } from "@reduxjs/toolkit";
|
|
|
|
import type { Game } from "@types";
|
|
|
|
interface LibraryState {
|
|
value: Game[];
|
|
}
|
|
|
|
const initialState: LibraryState = {
|
|
value: [],
|
|
};
|
|
|
|
export const librarySlice = createSlice({
|
|
name: "library",
|
|
initialState,
|
|
reducers: {
|
|
setLibrary: (state, action: PayloadAction<LibraryState["value"]>) => {
|
|
state.value = action.payload;
|
|
},
|
|
},
|
|
});
|
|
|
|
export const { setLibrary } = librarySlice.actions;
|