import { createSlice } from '@reduxjs/toolkit';
const initialState = { token : null, exp : 0 };

export const tokenSlice = createSlice({
  name: "token",
  initialState,
  reducers: {
    setToken: (state, action) => {
      state.token = action.payload;
    },
    removeToken: (state, _action) => {
      state.token = null;
    }
  }
})

export const { setToken, removeToken } = tokenSlice.actions;
export default tokenSlice.reducer;
