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