visuddhinanda 2 лет назад
Родитель
Сommit
70cc23d241
1 измененных файлов с 8 добавлено и 1 удалено
  1. 8 1
      dashboard/src/reducers/command.ts

+ 8 - 1
dashboard/src/reducers/command.ts

@@ -16,6 +16,7 @@ export interface ICommand {
 interface IState {
 interface IState {
   message?: ICommand;
   message?: ICommand;
   command?: "term" | "dict";
   command?: "term" | "dict";
+  lookup?: string;
 }
 }
 
 
 const initialState: IState = {};
 const initialState: IState = {};
@@ -24,17 +25,23 @@ export const slice = createSlice({
   name: "command",
   name: "command",
   initialState,
   initialState,
   reducers: {
   reducers: {
+    //TODO 去掉command
     command: (state, action: PayloadAction<ICommand>) => {
     command: (state, action: PayloadAction<ICommand>) => {
       state.message = action.payload;
       state.message = action.payload;
-      console.log("command", action.payload);
+    },
+    lookup: (state, action: PayloadAction<string | undefined>) => {
+      state.lookup = action.payload;
     },
     },
   },
   },
 });
 });
 
 
 export const { command } = slice.actions;
 export const { command } = slice.actions;
+export const { lookup } = slice.actions;
 export const commandParam = (state: RootState): IState => state.command;
 export const commandParam = (state: RootState): IState => state.command;
 
 
 export const message = (state: RootState): ICommand | undefined =>
 export const message = (state: RootState): ICommand | undefined =>
   state.command.message;
   state.command.message;
+export const lookupWord = (state: RootState): string | undefined =>
+  state.command.lookup;
 
 
 export default slice.reducer;
 export default slice.reducer;