import { createSlice } from "@reduxjs/toolkit";

const globalVariablesSlice = createSlice({
  name: "globalVariables",
  initialState: {
    loginUser:null,
    currentTenant:null
  },
  reducers: {
    setGlobalVariable: (state, action) => {
      const { key, value } = action.payload;
      state[key] = value;
    },
    setLoginUserPermmisions: ( state, action ) =>
    {
      state.loginUser = action.payload
    },
    setCurrentTenant:(state,action)=>{
      state.currentTenant = action.payload
    }
  },
});

export const { setGlobalVariable,setLoginUserPermmisions,setCurrentTenant } = globalVariablesSlice.actions;
export default globalVariablesSlice.reducer;
