selenium being fixed
This commit is contained in:
5
apps/Frontend/src/redux/hooks.ts
Normal file
5
apps/Frontend/src/redux/hooks.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import { TypedUseSelectorHook, useDispatch, useSelector } from "react-redux";
|
||||
import type { RootState, AppDispatch } from "./store";
|
||||
|
||||
export const useAppDispatch: () => AppDispatch = useDispatch;
|
||||
export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector;
|
||||
32
apps/Frontend/src/redux/slices/seleniumTaskSlice.ts
Normal file
32
apps/Frontend/src/redux/slices/seleniumTaskSlice.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
|
||||
|
||||
export type TaskStatus = "idle" | "pending" | "success" | "error";
|
||||
|
||||
export interface SeleniumTaskState {
|
||||
status: TaskStatus;
|
||||
message: string;
|
||||
show: boolean;
|
||||
}
|
||||
|
||||
const initialState: SeleniumTaskState = {
|
||||
status: "idle",
|
||||
message: "",
|
||||
show: false,
|
||||
};
|
||||
|
||||
const seleniumTaskSlice = createSlice({
|
||||
name: "seleniumTask",
|
||||
initialState,
|
||||
reducers: {
|
||||
setTaskStatus: (
|
||||
state: SeleniumTaskState,
|
||||
action: PayloadAction<Partial<SeleniumTaskState>>
|
||||
) => {
|
||||
return { ...state, ...action.payload, show: true };
|
||||
},
|
||||
clearTaskStatus: () => initialState,
|
||||
},
|
||||
});
|
||||
|
||||
export const { setTaskStatus, clearTaskStatus } = seleniumTaskSlice.actions;
|
||||
export default seleniumTaskSlice.reducer;
|
||||
11
apps/Frontend/src/redux/store.ts
Normal file
11
apps/Frontend/src/redux/store.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { configureStore } from "@reduxjs/toolkit";
|
||||
import seleniumTaskReducer from "./slices/seleniumTaskSlice";
|
||||
|
||||
export const store = configureStore({
|
||||
reducer: {
|
||||
seleniumTask: seleniumTaskReducer,
|
||||
},
|
||||
});
|
||||
|
||||
export type RootState = ReturnType<typeof store.getState>;
|
||||
export type AppDispatch = typeof store.dispatch;
|
||||
Reference in New Issue
Block a user