import { createSlice, PayloadAction } from '@reduxjs/toolkit'; import { Context } from '../../../context/Context'; import { AgoraConfigT } from '../../../context/type/AgoraConfigT'; import { v4 as uuidv4 } from "uuid"; const config : AgoraConfigT = { AppId: "3043eb1d6100457f9dcad1162237e8ff", Uid:Math.floor(Math.random() * 100)}; const initialState = { context: new Context(config)}; export const context : any = createSlice({ name: 'context', initialState, reducers: { setContext: (state, action: PayloadAction) => { state.context = action.payload.context ? action.payload.context : state.context; }, clearContext: (state) => { state = initialState; }, editContext: (state, action: PayloadAction) => { } }, }) // Action creators are generated for each case reducer function export const { setContext, clearContext, editContext } = context.actions; export default context.reducer;