@etsoo/react 1.1.82 → 1.1.86

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.
@@ -8,6 +8,9 @@ import { UserAction, UserState } from '../states/UserState';
8
8
  import { InputDialogProps } from './InputDialogProps';
9
9
  /**
10
10
  * React app state detector
11
+ * Case 1: undefined, when refresh the whole page
12
+ * Case 2: false, unauthorized
13
+ * Case 3: true, authorized or considered as authorized (maynot, like token expiry)
11
14
  * @param props Props
12
15
  * @returns Component
13
16
  */
@@ -47,6 +50,11 @@ export declare abstract class ReactApp<S extends IAppSettings, D extends IUser>
47
50
  * @param culture New culture definition
48
51
  */
49
52
  changeCultureEx(dispatch: React.Dispatch<CultureAction>, culture: DataTypes.CultureDefinition): void;
53
+ /**
54
+ * Try login
55
+ * Will update user state with UserActionType.Unauthorized
56
+ */
57
+ tryLogin(): void;
50
58
  /**
51
59
  * Set page data
52
60
  * @param data Page data
@@ -5,6 +5,9 @@ import { UserActionType, UserState } from '../states/UserState';
5
5
  let app;
6
6
  /**
7
7
  * React app state detector
8
+ * Case 1: undefined, when refresh the whole page
9
+ * Case 2: false, unauthorized
10
+ * Case 3: true, authorized or considered as authorized (maynot, like token expiry)
8
11
  * @param props Props
9
12
  * @returns Component
10
13
  */
@@ -52,6 +55,17 @@ export class ReactApp extends CoreApp {
52
55
  // Super call
53
56
  super.changeCulture(culture);
54
57
  }
58
+ /**
59
+ * Try login
60
+ * Will update user state with UserActionType.Unauthorized
61
+ */
62
+ tryLogin() {
63
+ // Dispatch action
64
+ if (this.userStateDispatch != null)
65
+ this.userStateDispatch({
66
+ type: UserActionType.Unauthorized
67
+ });
68
+ }
55
69
  /**
56
70
  * Set page data
57
71
  * @param data Page data
package/lib/index.d.ts CHANGED
@@ -27,6 +27,7 @@ export * from './mu/DataGridEx';
27
27
  export * from './mu/DataGridRenderers';
28
28
  export * from './mu/DialogButton';
29
29
  export * from './mu/DraggablePaperComponent';
30
+ export * from './mu/EmailInput';
30
31
  export * from './mu/FabBox';
31
32
  export * from './mu/FlexBox';
32
33
  export * from './mu/IconButtonLink';
package/lib/index.js CHANGED
@@ -30,6 +30,7 @@ export * from './mu/DataGridEx';
30
30
  export * from './mu/DataGridRenderers';
31
31
  export * from './mu/DialogButton';
32
32
  export * from './mu/DraggablePaperComponent';
33
+ export * from './mu/EmailInput';
33
34
  export * from './mu/FabBox';
34
35
  export * from './mu/FlexBox';
35
36
  export * from './mu/IconButtonLink';
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ import { TextFieldProps } from '@mui/material';
3
+ /**
4
+ * Email input props
5
+ */
6
+ export declare type EmailInputProps = Omit<TextFieldProps, 'type'> & {};
7
+ /**
8
+ * Email input
9
+ * @param props Props
10
+ */
11
+ export declare function EmailInput(props: EmailInputProps): JSX.Element;
@@ -0,0 +1,15 @@
1
+ import { TextField } from '@mui/material';
2
+ import React from 'react';
3
+ /**
4
+ * Email input
5
+ * @param props Props
6
+ */
7
+ export function EmailInput(props) {
8
+ var _a;
9
+ // Destruct
10
+ const { inputProps = {}, ...rest } = props;
11
+ // Default max length
12
+ (_a = inputProps.maxLength) !== null && _a !== void 0 ? _a : (inputProps.maxLength = 128);
13
+ // Layout
14
+ return (React.createElement(TextField, { type: "email", fullWidth: true, inputProps: inputProps, ...rest }));
15
+ }
@@ -11,6 +11,11 @@ export interface SearchBarProps {
11
11
  * Fields
12
12
  */
13
13
  fields: React.ReactElement[];
14
+ /**
15
+ * Inner height
16
+ * @default 40
17
+ */
18
+ innerHeight?: number;
14
19
  /**
15
20
  * On submit callback
16
21
  */
@@ -53,7 +53,7 @@ const setChildState = (child, enabled) => {
53
53
  */
54
54
  export function SearchBar(props) {
55
55
  // Destruct
56
- const { className, fields, onSubmit } = props;
56
+ const { className, fields, innerHeight = 40, onSubmit } = props;
57
57
  // Labels
58
58
  const labels = Labels.CommonPage;
59
59
  // Spacing
@@ -235,7 +235,7 @@ export function SearchBar(props) {
235
235
  if (form)
236
236
  forms.form = form;
237
237
  } },
238
- React.createElement(Stack, { ref: dimensions[0][0], justifyContent: "center", alignItems: "center", direction: "row", spacing: 1, sx: {
238
+ React.createElement(Stack, { ref: dimensions[0][0], justifyContent: "center", alignItems: "center", direction: "row", spacing: 1, height: innerHeight, sx: {
239
239
  '& > :not(style)': {
240
240
  flexBasis: 'auto',
241
241
  flexGrow: 0,
@@ -22,7 +22,7 @@ export const CommonPageScrollContainer = global;
22
22
  */
23
23
  export function CommonPage(props) {
24
24
  // Destruct
25
- const { children, disableGutters = true, fabButtons, fabSize = 'medium', maxWidth = false, moreActions, onRefresh, onUpdate, paddings = MUGlobal.pagePaddings, scrollContainer, pullContainer, sx = {}, ...rest } = props;
25
+ const { children, disableGutters = true, fabButtons, fabSize = 'medium', maxWidth = false, moreActions, onRefresh, onUpdate, onUpdateAll, paddings = MUGlobal.pagePaddings, scrollContainer, pullContainer, sx = {}, ...rest } = props;
26
26
  // Merge style
27
27
  Object.assign(sx, {
28
28
  padding: paddings
@@ -30,14 +30,19 @@ export function CommonPage(props) {
30
30
  // Labels
31
31
  const labels = Labels.CommonPage;
32
32
  // Update
33
- const update = onUpdate
34
- ? onUpdate
35
- : onRefresh
33
+ const update = onUpdateAll
34
+ ? onUpdateAll
35
+ : onUpdate
36
36
  ? (authorized) => {
37
- if (authorized)
38
- onRefresh();
37
+ if (authorized == null || authorized)
38
+ onUpdate();
39
39
  }
40
- : undefined;
40
+ : onRefresh
41
+ ? (authorized) => {
42
+ if (authorized)
43
+ onRefresh();
44
+ }
45
+ : undefined;
41
46
  // Return the UI
42
47
  return (React.createElement(React.Fragment, null,
43
48
  update && React.createElement(ReactAppStateDetector, { update: update }),
@@ -21,13 +21,17 @@ export interface CommonPageProps extends Omit<ContainerProps, 'id'> {
21
21
  */
22
22
  moreActions?: MoreAction[];
23
23
  /**
24
- * On refresh callback
24
+ * On refresh callback, only when authorized = true
25
25
  */
26
26
  onRefresh?: () => void | PromiseLike<void>;
27
27
  /**
28
- * On page update, may uses onRefresh
28
+ * On page update, when authorized = null or true case, may uses onRefresh
29
29
  */
30
- onUpdate?: IStateUpdate;
30
+ onUpdate?: () => void | PromiseLike<void>;
31
+ /**
32
+ * On page update, all cases with authorized
33
+ */
34
+ onUpdateAll?: IStateUpdate;
31
35
  /**
32
36
  * Paddings
33
37
  */
@@ -15,7 +15,7 @@ import { CommonPage } from './CommonPage';
15
15
  export function DataGridPage(props) {
16
16
  var _a, _b;
17
17
  // Destruct
18
- const { adjustHeight, fields, height, loadData, mRef, pageProps = {}, ...rest } = props;
18
+ const { adjustHeight, fields, height, loadData, mRef, sizeReadyMiliseconds = 100, pageProps = {}, ...rest } = props;
19
19
  (_a = pageProps.paddings) !== null && _a !== void 0 ? _a : (pageProps.paddings = MUGlobal.pagePaddings);
20
20
  // States
21
21
  const [states, setStates] = React.useReducer((currentState, newState) => {
@@ -38,7 +38,7 @@ export function DataGridPage(props) {
38
38
  return loadData({ ...json, ...rest });
39
39
  };
40
40
  // Watch container
41
- const { dimensions } = useDimensions(1, undefined, 50);
41
+ const { dimensions } = useDimensions(1, undefined, sizeReadyMiliseconds);
42
42
  const rect = dimensions[0][2];
43
43
  React.useEffect(() => {
44
44
  if (rect != null && rect.height > 50 && height == null) {
@@ -15,7 +15,7 @@ import { CommonPage } from './CommonPage';
15
15
  export function FixedListPage(props) {
16
16
  var _a;
17
17
  // Destruct
18
- const { adjustHeight, fields, loadData, mRef, pageProps = {}, ...rest } = props;
18
+ const { adjustHeight, fields, loadData, mRef, sizeReadyMiliseconds = 100, pageProps = {}, ...rest } = props;
19
19
  (_a = pageProps.paddings) !== null && _a !== void 0 ? _a : (pageProps.paddings = MUGlobal.pagePaddings);
20
20
  // States
21
21
  const [states] = React.useState({});
@@ -44,7 +44,7 @@ export function FixedListPage(props) {
44
44
  return loadData({ ...json, ...rest });
45
45
  };
46
46
  // Watch container
47
- const { dimensions } = useDimensions(1, undefined, 100);
47
+ const { dimensions } = useDimensions(1, undefined, sizeReadyMiliseconds);
48
48
  const rect = dimensions[0][2];
49
49
  const list = React.useMemo(() => {
50
50
  if (rect != null && rect.height > 50) {
@@ -16,7 +16,7 @@ import { CommonPage } from './CommonPage';
16
16
  export function ResponsivePage(props) {
17
17
  var _a, _b;
18
18
  // Destruct
19
- const { adjustHeight, columns, dataGridMinWidth = DataGridExCalColumns(columns).total, fields, height, loadData, innerItemRenderer, itemSize, mRef, pageProps = {}, ...rest } = props;
19
+ const { adjustHeight, columns, dataGridMinWidth = DataGridExCalColumns(columns).total, fields, height, loadData, innerItemRenderer, itemSize, mRef, sizeReadyMiliseconds = 100, pageProps = {}, ...rest } = props;
20
20
  (_a = pageProps.paddings) !== null && _a !== void 0 ? _a : (pageProps.paddings = MUGlobal.pagePaddings);
21
21
  // States
22
22
  const [states, setStates] = React.useReducer((currentState, newState) => {
@@ -39,7 +39,7 @@ export function ResponsivePage(props) {
39
39
  setStates({ data });
40
40
  };
41
41
  // Watch container
42
- const { dimensions } = useDimensions(1, undefined, 50);
42
+ const { dimensions } = useDimensions(1, undefined, sizeReadyMiliseconds);
43
43
  const rect = dimensions[0][2];
44
44
  const showDataGrid = ((_b = rect === null || rect === void 0 ? void 0 : rect.width) !== null && _b !== void 0 ? _b : 0) >= dataGridMinWidth;
45
45
  React.useEffect(() => {
@@ -17,4 +17,9 @@ export interface SearchPageProps<T> extends Omit<GridLoader<T>, 'loadData'> {
17
17
  * Page props
18
18
  */
19
19
  pageProps?: CommonPageProps;
20
+ /**
21
+ * Size ready to read miliseconds span
22
+ * @default 100
23
+ */
24
+ sizeReadyMiliseconds?: number;
20
25
  }
@@ -15,7 +15,7 @@ import { CommonPage, CommonPagePullContainer, CommonPageScrollContainer } from '
15
15
  export function TablePage(props) {
16
16
  var _a;
17
17
  // Destruct
18
- const { columns, fields, loadData, mRef, pageProps = {}, ...rest } = props;
18
+ const { columns, fields, loadData, mRef, sizeReadyMiliseconds = 100, pageProps = {}, ...rest } = props;
19
19
  (_a = pageProps.paddings) !== null && _a !== void 0 ? _a : (pageProps.paddings = MUGlobal.pagePaddings);
20
20
  // States
21
21
  const [states] = React.useState({});
@@ -47,7 +47,7 @@ export function TablePage(props) {
47
47
  return previousValue + ((_a = width !== null && width !== void 0 ? width : minWidth) !== null && _a !== void 0 ? _a : TableExMinWidth);
48
48
  }, 0), [columns]);
49
49
  // Watch container
50
- const { dimensions } = useDimensions(1, undefined, 100);
50
+ const { dimensions } = useDimensions(1, undefined, sizeReadyMiliseconds);
51
51
  const rect = dimensions[0][2];
52
52
  const list = React.useMemo(() => {
53
53
  if (rect != null && rect.height > 50 && rect.width >= totalWidth) {
@@ -8,7 +8,8 @@ import { IProviderProps, IUpdate } from './IState';
8
8
  export declare enum UserActionType {
9
9
  Login = "LOGIN",
10
10
  Logout = "LOGOUT",
11
- Update = "UPDATE"
11
+ Update = "UPDATE",
12
+ Unauthorized = "UNAUTHORIZED"
12
13
  }
13
14
  /**
14
15
  * User action to manage the user
@@ -5,12 +5,14 @@ import { State } from './State';
5
5
  */
6
6
  export var UserActionType;
7
7
  (function (UserActionType) {
8
- // Login action
8
+ // Login
9
9
  UserActionType["Login"] = "LOGIN";
10
- // Logout action
10
+ // Logout
11
11
  UserActionType["Logout"] = "LOGOUT";
12
- // Update action
12
+ // Update
13
13
  UserActionType["Update"] = "UPDATE";
14
+ // Unauthorized
15
+ UserActionType["Unauthorized"] = "UNAUTHORIZED";
14
16
  })(UserActionType || (UserActionType = {}));
15
17
  /**
16
18
  * User state
@@ -29,7 +31,7 @@ export class UserState {
29
31
  return {
30
32
  ...state,
31
33
  token: undefined,
32
- authorized: false // Flag as authorized
34
+ authorized: false // Flag as unauthorized
33
35
  };
34
36
  case UserActionType.Update:
35
37
  if (action.update) {
@@ -38,6 +40,11 @@ export class UserState {
38
40
  return newState;
39
41
  }
40
42
  return state;
43
+ case UserActionType.Unauthorized:
44
+ return {
45
+ ...state,
46
+ authorized: false // Flag as unauthorized
47
+ };
41
48
  default:
42
49
  return state;
43
50
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/react",
3
- "version": "1.1.82",
3
+ "version": "1.1.86",
4
4
  "description": "TypeScript ReactJs framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -23,6 +23,9 @@ let app: IReactApp<IAppSettings, any>;
23
23
 
24
24
  /**
25
25
  * React app state detector
26
+ * Case 1: undefined, when refresh the whole page
27
+ * Case 2: false, unauthorized
28
+ * Case 3: true, authorized or considered as authorized (maynot, like token expiry)
26
29
  * @param props Props
27
30
  * @returns Component
28
31
  */
@@ -103,6 +106,18 @@ export abstract class ReactApp<S extends IAppSettings, D extends IUser>
103
106
  super.changeCulture(culture);
104
107
  }
105
108
 
109
+ /**
110
+ * Try login
111
+ * Will update user state with UserActionType.Unauthorized
112
+ */
113
+ override tryLogin() {
114
+ // Dispatch action
115
+ if (this.userStateDispatch != null)
116
+ this.userStateDispatch({
117
+ type: UserActionType.Unauthorized
118
+ });
119
+ }
120
+
106
121
  /**
107
122
  * Set page data
108
123
  * @param data Page data
package/src/index.ts CHANGED
@@ -32,6 +32,7 @@ export * from './mu/DataGridEx';
32
32
  export * from './mu/DataGridRenderers';
33
33
  export * from './mu/DialogButton';
34
34
  export * from './mu/DraggablePaperComponent';
35
+ export * from './mu/EmailInput';
35
36
  export * from './mu/FabBox';
36
37
  export * from './mu/FlexBox';
37
38
  export * from './mu/IconButtonLink';
@@ -0,0 +1,24 @@
1
+ import { TextField, TextFieldProps } from '@mui/material';
2
+ import React from 'react';
3
+
4
+ /**
5
+ * Email input props
6
+ */
7
+ export type EmailInputProps = Omit<TextFieldProps, 'type'> & {};
8
+
9
+ /**
10
+ * Email input
11
+ * @param props Props
12
+ */
13
+ export function EmailInput(props: EmailInputProps) {
14
+ // Destruct
15
+ const { inputProps = {}, ...rest } = props;
16
+
17
+ // Default max length
18
+ inputProps.maxLength ??= 128;
19
+
20
+ // Layout
21
+ return (
22
+ <TextField type="email" fullWidth inputProps={inputProps} {...rest} />
23
+ );
24
+ }
@@ -20,6 +20,12 @@ export interface SearchBarProps {
20
20
  */
21
21
  fields: React.ReactElement[];
22
22
 
23
+ /**
24
+ * Inner height
25
+ * @default 40
26
+ */
27
+ innerHeight?: number;
28
+
23
29
  /**
24
30
  * On submit callback
25
31
  */
@@ -78,7 +84,7 @@ const setChildState = (child: Element, enabled: boolean) => {
78
84
  */
79
85
  export function SearchBar(props: SearchBarProps) {
80
86
  // Destruct
81
- const { className, fields, onSubmit } = props;
87
+ const { className, fields, innerHeight = 40, onSubmit } = props;
82
88
 
83
89
  // Labels
84
90
  const labels = Labels.CommonPage;
@@ -316,6 +322,7 @@ export function SearchBar(props: SearchBarProps) {
316
322
  alignItems="center"
317
323
  direction="row"
318
324
  spacing={1}
325
+ height={innerHeight}
319
326
  sx={{
320
327
  '& > :not(style)': {
321
328
  flexBasis: 'auto',
@@ -35,6 +35,7 @@ export function CommonPage(props: CommonPageProps) {
35
35
  moreActions,
36
36
  onRefresh,
37
37
  onUpdate,
38
+ onUpdateAll,
38
39
  paddings = MUGlobal.pagePaddings,
39
40
  scrollContainer,
40
41
  pullContainer,
@@ -51,8 +52,12 @@ export function CommonPage(props: CommonPageProps) {
51
52
  const labels = Labels.CommonPage;
52
53
 
53
54
  // Update
54
- const update = onUpdate
55
- ? onUpdate
55
+ const update = onUpdateAll
56
+ ? onUpdateAll
57
+ : onUpdate
58
+ ? (authorized?: boolean) => {
59
+ if (authorized == null || authorized) onUpdate();
60
+ }
56
61
  : onRefresh
57
62
  ? (authorized?: boolean) => {
58
63
  if (authorized) onRefresh();
@@ -24,14 +24,19 @@ export interface CommonPageProps extends Omit<ContainerProps, 'id'> {
24
24
  moreActions?: MoreAction[];
25
25
 
26
26
  /**
27
- * On refresh callback
27
+ * On refresh callback, only when authorized = true
28
28
  */
29
29
  onRefresh?: () => void | PromiseLike<void>;
30
30
 
31
31
  /**
32
- * On page update, may uses onRefresh
32
+ * On page update, when authorized = null or true case, may uses onRefresh
33
33
  */
34
- onUpdate?: IStateUpdate;
34
+ onUpdate?: () => void | PromiseLike<void>;
35
+
36
+ /**
37
+ * On page update, all cases with authorized
38
+ */
39
+ onUpdateAll?: IStateUpdate;
35
40
 
36
41
  /**
37
42
  * Paddings
@@ -30,6 +30,7 @@ export function DataGridPage<T>(props: DataGridPageProps<T>) {
30
30
  height,
31
31
  loadData,
32
32
  mRef,
33
+ sizeReadyMiliseconds = 100,
33
34
  pageProps = {},
34
35
  ...rest
35
36
  } = props;
@@ -63,7 +64,7 @@ export function DataGridPage<T>(props: DataGridPageProps<T>) {
63
64
  };
64
65
 
65
66
  // Watch container
66
- const { dimensions } = useDimensions(1, undefined, 50);
67
+ const { dimensions } = useDimensions(1, undefined, sizeReadyMiliseconds);
67
68
  const rect = dimensions[0][2];
68
69
 
69
70
  React.useEffect(() => {
@@ -30,6 +30,7 @@ export function FixedListPage<T>(
30
30
  fields,
31
31
  loadData,
32
32
  mRef,
33
+ sizeReadyMiliseconds = 100,
33
34
  pageProps = {},
34
35
  ...rest
35
36
  } = props;
@@ -74,7 +75,7 @@ export function FixedListPage<T>(
74
75
  };
75
76
 
76
77
  // Watch container
77
- const { dimensions } = useDimensions(1, undefined, 100);
78
+ const { dimensions } = useDimensions(1, undefined, sizeReadyMiliseconds);
78
79
  const rect = dimensions[0][2];
79
80
  const list = React.useMemo(() => {
80
81
  if (rect != null && rect.height > 50) {
@@ -35,6 +35,7 @@ export function ResponsivePage<T>(props: ResponsePageProps<T>) {
35
35
  innerItemRenderer,
36
36
  itemSize,
37
37
  mRef,
38
+ sizeReadyMiliseconds = 100,
38
39
  pageProps = {},
39
40
  ...rest
40
41
  } = props;
@@ -68,7 +69,7 @@ export function ResponsivePage<T>(props: ResponsePageProps<T>) {
68
69
  };
69
70
 
70
71
  // Watch container
71
- const { dimensions } = useDimensions(1, undefined, 50);
72
+ const { dimensions } = useDimensions(1, undefined, sizeReadyMiliseconds);
72
73
  const rect = dimensions[0][2];
73
74
  const showDataGrid = (rect?.width ?? 0) >= dataGridMinWidth;
74
75
 
@@ -19,4 +19,10 @@ export interface SearchPageProps<T> extends Omit<GridLoader<T>, 'loadData'> {
19
19
  * Page props
20
20
  */
21
21
  pageProps?: CommonPageProps;
22
+
23
+ /**
24
+ * Size ready to read miliseconds span
25
+ * @default 100
26
+ */
27
+ sizeReadyMiliseconds?: number;
22
28
  }
@@ -20,7 +20,15 @@ import { TablePageProps } from './TablePageProps';
20
20
  */
21
21
  export function TablePage<T>(props: TablePageProps<T>) {
22
22
  // Destruct
23
- const { columns, fields, loadData, mRef, pageProps = {}, ...rest } = props;
23
+ const {
24
+ columns,
25
+ fields,
26
+ loadData,
27
+ mRef,
28
+ sizeReadyMiliseconds = 100,
29
+ pageProps = {},
30
+ ...rest
31
+ } = props;
24
32
 
25
33
  pageProps.paddings ??= MUGlobal.pagePaddings;
26
34
 
@@ -66,7 +74,7 @@ export function TablePage<T>(props: TablePageProps<T>) {
66
74
  );
67
75
 
68
76
  // Watch container
69
- const { dimensions } = useDimensions(1, undefined, 100);
77
+ const { dimensions } = useDimensions(1, undefined, sizeReadyMiliseconds);
70
78
  const rect = dimensions[0][2];
71
79
  const list = React.useMemo(() => {
72
80
  if (rect != null && rect.height > 50 && rect.width >= totalWidth) {
@@ -7,14 +7,17 @@ import { State } from './State';
7
7
  * Style like 'const enum' will remove definition of the enum and cause module errors
8
8
  */
9
9
  export enum UserActionType {
10
- // Login action
10
+ // Login
11
11
  Login = 'LOGIN',
12
12
 
13
- // Logout action
13
+ // Logout
14
14
  Logout = 'LOGOUT',
15
15
 
16
- // Update action
17
- Update = 'UPDATE'
16
+ // Update
17
+ Update = 'UPDATE',
18
+
19
+ // Unauthorized
20
+ Unauthorized = 'UNAUTHORIZED'
18
21
  }
19
22
 
20
23
  /**
@@ -75,7 +78,7 @@ export class UserState<D extends IUser> {
75
78
  return {
76
79
  ...state, // Keep other user data
77
80
  token: undefined, // Remove token
78
- authorized: false // Flag as authorized
81
+ authorized: false // Flag as unauthorized
79
82
  };
80
83
  case UserActionType.Update:
81
84
  if (action.update) {
@@ -84,6 +87,11 @@ export class UserState<D extends IUser> {
84
87
  return newState;
85
88
  }
86
89
  return state;
90
+ case UserActionType.Unauthorized:
91
+ return {
92
+ ...state, // Keep other user data and token for refresh
93
+ authorized: false // Flag as unauthorized
94
+ };
87
95
  default:
88
96
  return state;
89
97
  }