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

const initialState = { profile : null, role :null }

export const userSlice = createSlice({
  name: 'user',
  initialState,
  reducers: {
    setProfile: (state, action) => {
      state.profile = action.payload;
    },
    setRole : (state, action ) => {
      state.role = Object.assign({}, state.role, action.payload);
    }
  }
})

export const { setProfile, setRole } = userSlice.actions;
export default userSlice.reducer;
