logout fixes with role redirect

This commit is contained in:
kurpfish
2021-08-20 17:33:29 +03:00
parent 8cce68ce06
commit 7891dccb59
14 changed files with 89 additions and 29 deletions

21
src/redux/roleSlice.js Normal file
View File

@ -0,0 +1,21 @@
import { createSlice } from '@reduxjs/toolkit';
const initialState = {
role: null,
};
export const roleSlice = createSlice({
name: 'role',
initialState,
reducers: {
setRole: (state, action) => {
state.role = action.payload;
},
},
});
export const { setRole } = roleSlice.actions;
export const getRole = (state) => state.role.role;
export default roleSlice.reducer;