mirror of https://github.com/usememos/memos
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
669 B
TypeScript
30 lines
669 B
TypeScript
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
|
|
|
|
interface State {
|
|
editMemoId?: MemoId;
|
|
memoVisibility: Visibility;
|
|
}
|
|
|
|
const editorSlice = createSlice({
|
|
name: "editor",
|
|
initialState: {} as State,
|
|
reducers: {
|
|
setEditMemoId: (state, action: PayloadAction<Option<MemoId>>) => {
|
|
return {
|
|
...state,
|
|
editMemoId: action.payload,
|
|
};
|
|
},
|
|
setMemoVisibility: (state, action: PayloadAction<Visibility>) => {
|
|
return {
|
|
...state,
|
|
memoVisibility: action.payload,
|
|
};
|
|
},
|
|
},
|
|
});
|
|
|
|
export const { setEditMemoId, setMemoVisibility } = editorSlice.actions;
|
|
|
|
export default editorSlice.reducer;
|