Add voiceSlice redux slice for voice icon state
This commit is contained in:
parent
66d688291c
commit
2c80c4b279
|
@ -1,8 +1,10 @@
|
|||
import { configureStore } from "@reduxjs/toolkit";
|
||||
import coreReducer from "../coreSlice";
|
||||
import voiceReducer from "../voiceSlice";
|
||||
|
||||
export default configureStore({
|
||||
reducer: {
|
||||
core: coreReducer,
|
||||
voice: voiceReducer,
|
||||
},
|
||||
});
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
import { createSlice } from "@reduxjs/toolkit";
|
||||
|
||||
export const voiceSlice = createSlice({
|
||||
name: "voice",
|
||||
initialState: {
|
||||
recording: false,
|
||||
text: null
|
||||
},
|
||||
reducers: {
|
||||
setRecording: (state, action) => ({...state, recording: action.payload}),
|
||||
setText: (state, action) => ({...state, text: action.payload}),
|
||||
}
|
||||
});
|
||||
|
||||
export const { setRecording, setText } = voiceSlice.actions;
|
||||
export const selectVoice = state => state.voice;
|
||||
export default voiceSlice.reducer;
|
Loading…
Reference in New Issue