summaryrefslogtreecommitdiff
path: root/extension/react-app/src/redux/slices/configSlice.ts
diff options
context:
space:
mode:
Diffstat (limited to 'extension/react-app/src/redux/slices/configSlice.ts')
-rw-r--r--extension/react-app/src/redux/slices/configSlice.ts45
1 files changed, 45 insertions, 0 deletions
diff --git a/extension/react-app/src/redux/slices/configSlice.ts b/extension/react-app/src/redux/slices/configSlice.ts
new file mode 100644
index 00000000..a6a641e6
--- /dev/null
+++ b/extension/react-app/src/redux/slices/configSlice.ts
@@ -0,0 +1,45 @@
+import { createSlice } from "@reduxjs/toolkit";
+import { RootStore } from "../store";
+
+export const configSlice = createSlice({
+ name: "config",
+ initialState: {
+ apiUrl: "http://localhost:8000",
+ } as RootStore["config"],
+ reducers: {
+ setWorkspacePath: (
+ state: RootStore["config"],
+ action: { type: string; payload: string }
+ ) => {
+ return {
+ ...state,
+ workspacePath: action.payload,
+ };
+ },
+ setApiUrl: (
+ state: RootStore["config"],
+ action: { type: string; payload: string }
+ ) => ({
+ ...state,
+ apiUrl: action.payload,
+ }),
+ setVscMachineId: (
+ state: RootStore["config"],
+ action: { type: string; payload: string }
+ ) => ({
+ ...state,
+ vscMachineId: action.payload,
+ }),
+ setSessionId: (
+ state: RootStore["config"],
+ action: { type: string; payload: string }
+ ) => ({
+ ...state,
+ sessionId: action.payload,
+ }),
+ },
+});
+
+export const { setVscMachineId, setApiUrl, setWorkspacePath, setSessionId } =
+ configSlice.actions;
+export default configSlice.reducer;