Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | 25x 25x 25x 25x 1x 1x 1x 1x 25x 25x 25x | import { createSlice, PayloadAction } from "@reduxjs/toolkit";
import { RootState } from "store/configureStore";
import projectActions from "store/features/project/projectActions";
export interface MetadataState {
name: string;
author: string;
notes: string;
_version: string;
_release: string;
}
export const initialState: MetadataState = {
name: "",
author: "",
notes: "",
_version: "",
_release: "",
};
const metadataSlice = createSlice({
name: "metadata",
initialState,
reducers: {
editMetadata: (state, action: PayloadAction<Partial<MetadataState>>) => {
return {
...state,
...action.payload,
};
},
},
extraReducers: (builder) =>
builder.addCase(projectActions.loadProject.fulfilled, (state, action) => {
const { name, author, notes, _version, _release } =
action.payload.resources.metadata;
return {
...state,
name,
author,
notes,
_version,
_release,
};
}),
});
export const getMetadata = (state: RootState) => state.project.present.metadata;
export const { actions } = metadataSlice;
export default metadataSlice.reducer;
|