@fluxo-dev/state 0.0.8 → 0.0.9
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.
- package/index.esm.d.ts +1 -0
- package/index.esm.js +36574 -0
- package/package.json +4 -1
- package/src/{index.ts → index.d.ts} +1 -2
- package/src/lib/constants/local-storage.d.ts +4 -0
- package/src/lib/fluxo-client/fluxoClientSlice.d.ts +7 -0
- package/src/lib/fluxo-client-configuration.d.ts +9 -0
- package/src/lib/layout/layoutSlice.d.ts +14 -0
- package/src/lib/route-rule/route-rule-slice.d.ts +6 -0
- package/src/lib/store.d.ts +17 -0
- package/src/lib/user/userActions.d.ts +22 -0
- package/src/lib/user/userSlice.d.ts +13 -0
- package/.babelrc +0 -12
- package/.eslintrc.json +0 -18
- package/jest.config.ts +0 -11
- package/project.json +0 -43
- package/src/lib/constants/local-storage.ts +0 -4
- package/src/lib/fluxo-client/fluxoClientSlice.ts +0 -27
- package/src/lib/fluxo-client-configuration.ts +0 -10
- package/src/lib/layout/layoutSlice.ts +0 -67
- package/src/lib/route-rule/route-rule-slice.ts +0 -25
- package/src/lib/store.ts +0 -29
- package/src/lib/user/userActions.ts +0 -28
- package/src/lib/user/userSlice.ts +0 -82
- package/tsconfig.json +0 -25
- package/tsconfig.lib.json +0 -23
- package/tsconfig.spec.json +0 -20
package/package.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export * from './lib/fluxo-client/fluxoClientSlice'
|
|
1
|
+
export * from './lib/fluxo-client/fluxoClientSlice';
|
|
2
2
|
export * from './lib/store';
|
|
3
3
|
export * from './lib/fluxo-client-configuration';
|
|
4
|
-
|
|
5
4
|
export * from './lib/fluxo-client/fluxoClientSlice';
|
|
6
5
|
export * from './lib/layout/layoutSlice';
|
|
7
6
|
export * from './lib/user/userActions';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FluxoClientConfiguration } from "../fluxo-client-configuration";
|
|
2
|
+
export interface IFluxoClientSliceState {
|
|
3
|
+
fluxoClientConfig: FluxoClientConfiguration | null;
|
|
4
|
+
}
|
|
5
|
+
export declare const setFluxoClientConfiguration: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "fluxoClient/setFluxoClientConfiguration">;
|
|
6
|
+
declare const _default: import("redux").Reducer<IFluxoClientSliceState>;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const openSearchPanel: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "layout/openSearchPanel">, closeSearchPanel: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "layout/closeSearchPanel">, setUserIdle: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "layout/setUserIdle">, unsetUserIdle: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "layout/unsetUserIdle">, openNavbar: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "layout/openNavbar">, closeNavbar: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "layout/closeNavbar">, setConfiguration: import("@reduxjs/toolkit").ActionCreatorWithPayload<any[], "layout/setConfiguration">, setSysFeatures: import("@reduxjs/toolkit").ActionCreatorWithPayload<any[], "layout/setSysFeatures">, setJitAppsFeatures: import("@reduxjs/toolkit").ActionCreatorWithPayload<any[], "layout/setJitAppsFeatures">, setAppMenu: import("@reduxjs/toolkit").ActionCreatorWithPayload<any[], "layout/setAppMenu">;
|
|
2
|
+
declare const _default: import("redux").Reducer<{
|
|
3
|
+
loading: boolean;
|
|
4
|
+
searchPanelOpened: boolean;
|
|
5
|
+
userIdle: boolean;
|
|
6
|
+
navbarOpened: boolean;
|
|
7
|
+
configuration: any;
|
|
8
|
+
appMenu: any[];
|
|
9
|
+
sysFeatures: any;
|
|
10
|
+
jitAppFeatures: any;
|
|
11
|
+
}>;
|
|
12
|
+
export default _default;
|
|
13
|
+
export declare class toggleUserIdle {
|
|
14
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export interface IFluxoRouteRuleSliceState {
|
|
2
|
+
routeRules: any[] | null;
|
|
3
|
+
}
|
|
4
|
+
export declare const setRouteRules: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "fluxoRouteRule/setRouteRules">;
|
|
5
|
+
declare const _default: import("redux").Reducer<IFluxoRouteRuleSliceState>;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import userReducer from './user/userSlice';
|
|
2
|
+
import layoutReducer from './layout/layoutSlice';
|
|
3
|
+
import fluxoClientReducer from './fluxo-client/fluxoClientSlice';
|
|
4
|
+
import fluxoRouteRuleReducer from './route-rule/route-rule-slice';
|
|
5
|
+
import { TypedUseSelectorHook } from "react-redux";
|
|
6
|
+
export interface IFluxoRootState {
|
|
7
|
+
user: ReturnType<typeof userReducer>;
|
|
8
|
+
layout: ReturnType<typeof layoutReducer>;
|
|
9
|
+
client: ReturnType<typeof fluxoClientReducer>;
|
|
10
|
+
routeRules: ReturnType<typeof fluxoRouteRuleReducer>;
|
|
11
|
+
}
|
|
12
|
+
export declare const store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore<IFluxoRootState, import("redux").AnyAction, [import("@reduxjs/toolkit").ThunkMiddleware<IFluxoRootState, import("redux").AnyAction>]>;
|
|
13
|
+
type AppDispatch = typeof store.dispatch;
|
|
14
|
+
type RootState = ReturnType<typeof store.getState>;
|
|
15
|
+
export declare const useAppDispatch: () => AppDispatch;
|
|
16
|
+
export declare const useAppSelector: TypedUseSelectorHook<RootState>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const userLogin: import("@reduxjs/toolkit").AsyncThunk<any, {
|
|
2
|
+
id: string;
|
|
3
|
+
} & Partial<any>, {
|
|
4
|
+
rejectValue: any;
|
|
5
|
+
state?: unknown;
|
|
6
|
+
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
7
|
+
extra?: unknown;
|
|
8
|
+
serializedErrorType?: unknown;
|
|
9
|
+
pendingMeta?: unknown;
|
|
10
|
+
fulfilledMeta?: unknown;
|
|
11
|
+
rejectedMeta?: unknown;
|
|
12
|
+
}>;
|
|
13
|
+
export declare const userLogout: import("@reduxjs/toolkit").AsyncThunk<boolean, void, {
|
|
14
|
+
state?: unknown;
|
|
15
|
+
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
16
|
+
extra?: unknown;
|
|
17
|
+
rejectValue?: unknown;
|
|
18
|
+
serializedErrorType?: unknown;
|
|
19
|
+
pendingMeta?: unknown;
|
|
20
|
+
fulfilledMeta?: unknown;
|
|
21
|
+
rejectedMeta?: unknown;
|
|
22
|
+
}>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
interface UserState {
|
|
2
|
+
loading: boolean;
|
|
3
|
+
userInfo: any;
|
|
4
|
+
accessToken: string | null;
|
|
5
|
+
error: boolean;
|
|
6
|
+
success: boolean;
|
|
7
|
+
loggedIn: boolean;
|
|
8
|
+
userPermissions: any[];
|
|
9
|
+
roles: string[];
|
|
10
|
+
}
|
|
11
|
+
export declare const autoLoginSucceded: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "user/autoLoginSucceded">, setUserPermissions: import("@reduxjs/toolkit").ActionCreatorWithPayload<any[], "user/setUserPermissions">;
|
|
12
|
+
declare const _default: import("redux").Reducer<UserState>;
|
|
13
|
+
export default _default;
|
package/.babelrc
DELETED
package/.eslintrc.json
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": ["plugin:@nx/react", "../../../.eslintrc.json"],
|
|
3
|
-
"ignorePatterns": ["!**/*"],
|
|
4
|
-
"overrides": [
|
|
5
|
-
{
|
|
6
|
-
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
|
|
7
|
-
"rules": {}
|
|
8
|
-
},
|
|
9
|
-
{
|
|
10
|
-
"files": ["*.ts", "*.tsx"],
|
|
11
|
-
"rules": {}
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
"files": ["*.js", "*.jsx"],
|
|
15
|
-
"rules": {}
|
|
16
|
-
}
|
|
17
|
-
]
|
|
18
|
-
}
|
package/jest.config.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
export default {
|
|
3
|
-
displayName: 'shared-state',
|
|
4
|
-
preset: '../../../jest.preset.js',
|
|
5
|
-
transform: {
|
|
6
|
-
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest',
|
|
7
|
-
'^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/react/babel'] }],
|
|
8
|
-
},
|
|
9
|
-
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
|
|
10
|
-
coverageDirectory: '../../../coverage/libs/shared/state',
|
|
11
|
-
};
|
package/project.json
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "shared-state",
|
|
3
|
-
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
|
|
4
|
-
"sourceRoot": "libs/shared/state/src",
|
|
5
|
-
"projectType": "library",
|
|
6
|
-
"tags": ["scope:shared-state"],
|
|
7
|
-
"targets": {
|
|
8
|
-
"build": {
|
|
9
|
-
"executor": "@nx/rollup:rollup",
|
|
10
|
-
"outputs": ["{options.outputPath}"],
|
|
11
|
-
"options": {
|
|
12
|
-
"outputPath": "dist/libs/shared/state",
|
|
13
|
-
"tsConfig": "libs/shared/state/tsconfig.lib.json",
|
|
14
|
-
"project": "libs/shared/state/package.json",
|
|
15
|
-
"entryFile": "libs/shared/state/src/index.ts",
|
|
16
|
-
"external": ["react/jsx-runtime"],
|
|
17
|
-
"rollupConfig": "@nx/react/plugins/bundle-rollup",
|
|
18
|
-
"compiler": "babel",
|
|
19
|
-
"assets": [
|
|
20
|
-
{
|
|
21
|
-
"glob": "libs/shared/state/README.md",
|
|
22
|
-
"input": ".",
|
|
23
|
-
"output": "."
|
|
24
|
-
}
|
|
25
|
-
]
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
"lint": {
|
|
29
|
-
"executor": "@nx/eslint:lint",
|
|
30
|
-
"outputs": ["{options.outputFile}"],
|
|
31
|
-
"options": {
|
|
32
|
-
"lintFilePatterns": ["libs/shared/state/**/*.{ts,tsx,js,jsx}"]
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
"test": {
|
|
36
|
-
"executor": "@nx/jest:jest",
|
|
37
|
-
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
|
|
38
|
-
"options": {
|
|
39
|
-
"jestConfig": "libs/shared/state/jest.config.ts"
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
-
import {FluxoClientConfiguration} from "../fluxo-client-configuration";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export interface IFluxoClientSliceState {
|
|
6
|
-
fluxoClientConfig: FluxoClientConfiguration | null;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
const initialState: IFluxoClientSliceState = {
|
|
10
|
-
fluxoClientConfig: null,
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const fluxoClientSlice = createSlice({
|
|
14
|
-
name: 'fluxoClient',
|
|
15
|
-
initialState,
|
|
16
|
-
reducers: {
|
|
17
|
-
setFluxoClientConfiguration(state, action) {
|
|
18
|
-
state.fluxoClientConfig = action.payload
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
export const {
|
|
24
|
-
setFluxoClientConfiguration
|
|
25
|
-
} = fluxoClientSlice.actions;
|
|
26
|
-
|
|
27
|
-
export default fluxoClientSlice.reducer
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import {createSlice, PayloadAction} from '@reduxjs/toolkit'
|
|
2
|
-
|
|
3
|
-
const initialState: {loading: boolean, searchPanelOpened: boolean, userIdle: boolean, navbarOpened: boolean, configuration: any, appMenu: any[], sysFeatures: any, jitAppFeatures: any} = {
|
|
4
|
-
loading: false,
|
|
5
|
-
searchPanelOpened: false,
|
|
6
|
-
userIdle: false,
|
|
7
|
-
navbarOpened: false,
|
|
8
|
-
configuration: {},
|
|
9
|
-
appMenu: [],
|
|
10
|
-
sysFeatures: {},
|
|
11
|
-
jitAppFeatures: {}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const layoutSlice = createSlice({
|
|
15
|
-
name: 'layout',
|
|
16
|
-
initialState,
|
|
17
|
-
reducers: {
|
|
18
|
-
openSearchPanel(state, action) {
|
|
19
|
-
state.searchPanelOpened = true
|
|
20
|
-
},
|
|
21
|
-
closeSearchPanel(state, action) {
|
|
22
|
-
state.searchPanelOpened = false
|
|
23
|
-
},
|
|
24
|
-
openNavbar(state, action) {
|
|
25
|
-
state.navbarOpened = true
|
|
26
|
-
},
|
|
27
|
-
closeNavbar(state, action) {
|
|
28
|
-
state.navbarOpened = false
|
|
29
|
-
},
|
|
30
|
-
setUserIdle(state, action) {
|
|
31
|
-
state.userIdle = true
|
|
32
|
-
},
|
|
33
|
-
unsetUserIdle(state, action) {
|
|
34
|
-
state.userIdle = false
|
|
35
|
-
},
|
|
36
|
-
setConfiguration(state, action: PayloadAction<any[]>) {
|
|
37
|
-
state.configuration = action.payload;
|
|
38
|
-
},
|
|
39
|
-
setSysFeatures(state, action: PayloadAction<any[]>) {
|
|
40
|
-
state.sysFeatures = action.payload;
|
|
41
|
-
},
|
|
42
|
-
setJitAppsFeatures(state, action: PayloadAction<any[]>) {
|
|
43
|
-
state.jitAppFeatures = action.payload;
|
|
44
|
-
},
|
|
45
|
-
setAppMenu(state, action: PayloadAction<any[]>) {
|
|
46
|
-
state.appMenu = action.payload;
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
export const {
|
|
52
|
-
openSearchPanel,
|
|
53
|
-
closeSearchPanel,
|
|
54
|
-
setUserIdle,
|
|
55
|
-
unsetUserIdle,
|
|
56
|
-
openNavbar,
|
|
57
|
-
closeNavbar,
|
|
58
|
-
setConfiguration,
|
|
59
|
-
setSysFeatures,
|
|
60
|
-
setJitAppsFeatures,
|
|
61
|
-
setAppMenu,
|
|
62
|
-
} = layoutSlice.actions;
|
|
63
|
-
|
|
64
|
-
export default layoutSlice.reducer
|
|
65
|
-
|
|
66
|
-
export class toggleUserIdle {
|
|
67
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
-
|
|
3
|
-
export interface IFluxoRouteRuleSliceState {
|
|
4
|
-
routeRules: any[] | null;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
const initialState: IFluxoRouteRuleSliceState = {
|
|
8
|
-
routeRules: null,
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const fluxoRouteSlice = createSlice({
|
|
12
|
-
name: 'fluxoRouteRule',
|
|
13
|
-
initialState,
|
|
14
|
-
reducers: {
|
|
15
|
-
setRouteRules(state, action) {
|
|
16
|
-
state.routeRules = action.payload
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
export const {
|
|
22
|
-
setRouteRules
|
|
23
|
-
} = fluxoRouteSlice.actions;
|
|
24
|
-
|
|
25
|
-
export default fluxoRouteSlice.reducer
|
package/src/lib/store.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { configureStore } from '@reduxjs/toolkit'
|
|
2
|
-
import userReducer from './user/userSlice'
|
|
3
|
-
import layoutReducer from './layout/layoutSlice'
|
|
4
|
-
import fluxoClientReducer from './fluxo-client/fluxoClientSlice'
|
|
5
|
-
import fluxoRouteRuleReducer from './route-rule/route-rule-slice';
|
|
6
|
-
import {TypedUseSelectorHook, useDispatch, useSelector} from "react-redux";
|
|
7
|
-
|
|
8
|
-
export interface IFluxoRootState {
|
|
9
|
-
user: ReturnType<typeof userReducer>;
|
|
10
|
-
layout: ReturnType<typeof layoutReducer>;
|
|
11
|
-
client: ReturnType<typeof fluxoClientReducer>;
|
|
12
|
-
routeRules: ReturnType<typeof fluxoRouteRuleReducer>;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const store = configureStore<IFluxoRootState>({
|
|
16
|
-
reducer: {
|
|
17
|
-
user: userReducer,
|
|
18
|
-
layout: layoutReducer,
|
|
19
|
-
client: fluxoClientReducer,
|
|
20
|
-
routeRules: fluxoRouteRuleReducer,
|
|
21
|
-
},
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
type AppDispatch = typeof store.dispatch
|
|
25
|
-
type RootState = ReturnType<typeof store.getState>
|
|
26
|
-
|
|
27
|
-
// Use throughout your app instead of plain `useDispatch` and `useSelector`
|
|
28
|
-
export const useAppDispatch : () => AppDispatch = useDispatch
|
|
29
|
-
export const useAppSelector : TypedUseSelectorHook<RootState> = useSelector
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import {createAsyncThunk} from "@reduxjs/toolkit";
|
|
2
|
-
|
|
3
|
-
export const userLogin = createAsyncThunk<any, { id: string } & Partial<any>, { rejectValue: any}>(
|
|
4
|
-
'user/login',
|
|
5
|
-
async ({ data }, { rejectWithValue, getState }) => {
|
|
6
|
-
try {
|
|
7
|
-
return data
|
|
8
|
-
} catch (error: any) {
|
|
9
|
-
// return custom error message from API if any
|
|
10
|
-
if (error.response && error.response.data.message) {
|
|
11
|
-
return rejectWithValue(error.response.data.message)
|
|
12
|
-
} else {
|
|
13
|
-
return rejectWithValue(error.message)
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
)
|
|
18
|
-
|
|
19
|
-
export const userLogout = createAsyncThunk(
|
|
20
|
-
'user/logout',
|
|
21
|
-
async () => {
|
|
22
|
-
try {
|
|
23
|
-
return true;
|
|
24
|
-
} catch (error: any) {
|
|
25
|
-
return true;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
)
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import {createSlice, PayloadAction} from '@reduxjs/toolkit'
|
|
2
|
-
import {userLogin, userLogout} from "./userActions";
|
|
3
|
-
import {LocalStorageConstants} from "../constants/local-storage";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
interface UserState {
|
|
7
|
-
loading: boolean;
|
|
8
|
-
userInfo: any;
|
|
9
|
-
accessToken: string | null;
|
|
10
|
-
error: boolean;
|
|
11
|
-
success: boolean;
|
|
12
|
-
loggedIn: boolean;
|
|
13
|
-
userPermissions: any[];
|
|
14
|
-
roles: string[];
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const initialState: UserState = {
|
|
18
|
-
loading: false,
|
|
19
|
-
userInfo: JSON.parse(localStorage.getItem(LocalStorageConstants.userData) ?? '{}'), // for user object
|
|
20
|
-
accessToken: localStorage.getItem(LocalStorageConstants.accessToken ?? ''), // for storing the JWT
|
|
21
|
-
error: false,
|
|
22
|
-
success: false,
|
|
23
|
-
loggedIn: false,
|
|
24
|
-
userPermissions: [],
|
|
25
|
-
roles: []
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const userSlice = createSlice({
|
|
29
|
-
name: 'user',
|
|
30
|
-
initialState,
|
|
31
|
-
reducers: {
|
|
32
|
-
autoLoginSucceded: (state, action) => {
|
|
33
|
-
state.loading = false;
|
|
34
|
-
state.userInfo = JSON.parse(action.payload);
|
|
35
|
-
state.loggedIn = true;
|
|
36
|
-
state.error = false;
|
|
37
|
-
state.success = true;
|
|
38
|
-
state.roles = [JSON.parse(action.payload)["http://schemas.microsoft.com/ws/2008/06/identity/claims/role"]];
|
|
39
|
-
},
|
|
40
|
-
setUserPermissions(state, action: PayloadAction<any[]>) {
|
|
41
|
-
state.userPermissions = action.payload;
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
extraReducers: (builder) => {
|
|
45
|
-
builder.addCase(userLogin.pending, (state, action) => {
|
|
46
|
-
state.loggedIn = false;
|
|
47
|
-
state.loading = true
|
|
48
|
-
state.error = false
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
builder.addCase(userLogin.fulfilled, (state, action) => {
|
|
52
|
-
state.loading = false
|
|
53
|
-
state.loggedIn = true;
|
|
54
|
-
state.userInfo = action.payload.userData
|
|
55
|
-
state.accessToken = action.payload.token
|
|
56
|
-
state.roles = action.payload.role
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
builder.addCase(userLogin.rejected, (state, action) => {
|
|
60
|
-
state.loading = false
|
|
61
|
-
state.loggedIn = false;
|
|
62
|
-
state.error = true;//(action.payload as any).error as any
|
|
63
|
-
state.roles = []
|
|
64
|
-
})
|
|
65
|
-
|
|
66
|
-
builder.addCase(userLogout.fulfilled, (state, action) => {
|
|
67
|
-
state.loading = false
|
|
68
|
-
state.loggedIn = false;
|
|
69
|
-
state.error = false;
|
|
70
|
-
state.userInfo = JSON.parse('{}');
|
|
71
|
-
state.accessToken = '';
|
|
72
|
-
state.roles = []
|
|
73
|
-
})
|
|
74
|
-
},
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
export const {
|
|
78
|
-
autoLoginSucceded,
|
|
79
|
-
setUserPermissions
|
|
80
|
-
} = userSlice.actions;
|
|
81
|
-
|
|
82
|
-
export default userSlice.reducer
|
package/tsconfig.json
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../../tsconfig.base.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"jsx": "react-jsx",
|
|
5
|
-
"allowJs": true,
|
|
6
|
-
"esModuleInterop": true,
|
|
7
|
-
"allowSyntheticDefaultImports": true,
|
|
8
|
-
"forceConsistentCasingInFileNames": true,
|
|
9
|
-
"strict": true,
|
|
10
|
-
"noImplicitOverride": true,
|
|
11
|
-
"noPropertyAccessFromIndexSignature": true,
|
|
12
|
-
"noImplicitReturns": true,
|
|
13
|
-
"noFallthroughCasesInSwitch": true
|
|
14
|
-
},
|
|
15
|
-
"files": [],
|
|
16
|
-
"include": [],
|
|
17
|
-
"references": [
|
|
18
|
-
{
|
|
19
|
-
"path": "./tsconfig.lib.json"
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
"path": "./tsconfig.spec.json"
|
|
23
|
-
}
|
|
24
|
-
]
|
|
25
|
-
}
|
package/tsconfig.lib.json
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "./tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"outDir": "../../../dist/out-tsc",
|
|
5
|
-
"types": ["node"]
|
|
6
|
-
},
|
|
7
|
-
"files": [
|
|
8
|
-
"../../../node_modules/@nx/react/typings/cssmodule.d.ts",
|
|
9
|
-
"../../../node_modules/@nx/react/typings/image.d.ts"
|
|
10
|
-
],
|
|
11
|
-
"exclude": [
|
|
12
|
-
"jest.config.ts",
|
|
13
|
-
"**/*.spec.ts",
|
|
14
|
-
"**/*.test.ts",
|
|
15
|
-
"**/*.spec.tsx",
|
|
16
|
-
"**/*.test.tsx",
|
|
17
|
-
"**/*.spec.js",
|
|
18
|
-
"**/*.test.js",
|
|
19
|
-
"**/*.spec.jsx",
|
|
20
|
-
"**/*.test.jsx"
|
|
21
|
-
],
|
|
22
|
-
"include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"]
|
|
23
|
-
}
|
package/tsconfig.spec.json
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "./tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"outDir": "../../../dist/out-tsc",
|
|
5
|
-
"module": "commonjs",
|
|
6
|
-
"types": ["jest", "node"]
|
|
7
|
-
},
|
|
8
|
-
"include": [
|
|
9
|
-
"jest.config.ts",
|
|
10
|
-
"**/*.test.ts",
|
|
11
|
-
"**/*.spec.ts",
|
|
12
|
-
"**/*.test.tsx",
|
|
13
|
-
"**/*.spec.tsx",
|
|
14
|
-
"**/*.test.js",
|
|
15
|
-
"**/*.spec.js",
|
|
16
|
-
"**/*.test.jsx",
|
|
17
|
-
"**/*.spec.jsx",
|
|
18
|
-
"**/*.d.ts"
|
|
19
|
-
]
|
|
20
|
-
}
|