@opble/auth0-react 1.1.4 → 1.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,19 @@
1
+ import { createSlice } from '@reduxjs/toolkit';
2
+ import { authReducerPath } from './types';
3
+ const slice = createSlice({
4
+ name: authReducerPath,
5
+ initialState: {},
6
+ reducers: {
7
+ clearAuth: (state) => {
8
+ state.accessToken = undefined;
9
+ },
10
+ setAccessToken: (state, action) => {
11
+ state.accessToken = action.payload;
12
+ },
13
+ setUser: (state, action) => {
14
+ state.user = action.payload;
15
+ },
16
+ },
17
+ });
18
+ export const { clearAuth, setAccessToken, setUser } = slice.actions;
19
+ export const authReducer = slice.reducer;
@@ -0,0 +1,3 @@
1
+ import { authReducerPath } from './types';
2
+ export const selectAccessToken = (state) => state[authReducerPath].accessToken;
3
+ export const selectUser = (state) => state[authReducerPath].user;
@@ -0,0 +1 @@
1
+ export const authReducerPath = 'auth';