mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-24 19:31:03 +00:00
first commit
This commit is contained in:
24
src/renderer/features/library-slice.ts
Normal file
24
src/renderer/features/library-slice.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
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;
|
||||
Reference in New Issue
Block a user