File tree Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ import { useActor } from "@xstate/react"
2
2
import React , { useContext , useEffect } from "react"
3
3
import { useNavigate } from "react-router"
4
4
import { ConfirmDialog } from "../../components/ConfirmDialog/ConfirmDialog"
5
- import { ErrorSummary } from "../../components/ErrorSummary/ErrorSummary"
6
5
import { FullScreenLoader } from "../../components/Loader/FullScreenLoader"
7
6
import { XServiceContext } from "../../xServices/StateContext"
8
7
import { UsersPageView } from "./UsersPageView"
@@ -26,10 +25,6 @@ export const UsersPage: React.FC = () => {
26
25
usersSend ( "GET_USERS" )
27
26
} , [ usersSend ] )
28
27
29
- if ( usersState . matches ( "error" ) ) {
30
- return < ErrorSummary error = { getUsersError } />
31
- }
32
-
33
28
if ( ! users ) {
34
29
return < FullScreenLoader />
35
30
} else {
@@ -43,6 +38,7 @@ export const UsersPage: React.FC = () => {
43
38
onSuspendUser = { ( user ) => {
44
39
usersSend ( { type : "SUSPEND_USER" , userId : user . id } )
45
40
} }
41
+ error = { getUsersError }
46
42
/>
47
43
48
44
< ConfirmDialog
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import Paper from "@material-ui/core/Paper"
2
2
import { makeStyles } from "@material-ui/core/styles"
3
3
import React from "react"
4
4
import { UserResponse } from "../../api/types"
5
+ import { ErrorSummary } from "../../components/ErrorSummary/ErrorSummary"
5
6
import { Header } from "../../components/Header/Header"
6
7
import { UsersTable } from "../../components/UsersTable/UsersTable"
7
8
@@ -14,16 +15,22 @@ export interface UsersPageViewProps {
14
15
users : UserResponse [ ]
15
16
openUserCreationDialog : ( ) => void
16
17
onSuspendUser : ( user : UserResponse ) => void
18
+ error ?: unknown
17
19
}
18
20
19
- export const UsersPageView : React . FC < UsersPageViewProps > = ( { users, openUserCreationDialog, onSuspendUser } ) => {
21
+ export const UsersPageView : React . FC < UsersPageViewProps > = ( {
22
+ users,
23
+ openUserCreationDialog,
24
+ onSuspendUser,
25
+ error,
26
+ } ) => {
20
27
const styles = useStyles ( )
21
28
22
29
return (
23
30
< div className = { styles . flexColumn } >
24
31
< Header title = { Language . pageTitle } action = { { text : Language . newUserButton , onClick : openUserCreationDialog } } />
25
32
< Paper style = { { maxWidth : "1380px" , margin : "1em auto" , width : "100%" } } >
26
- < UsersTable users = { users } onSuspendUser = { onSuspendUser } />
33
+ { error ? < ErrorSummary error = { error } /> : < UsersTable users = { users } onSuspendUser = { onSuspendUser } /> }
27
34
</ Paper >
28
35
</ div >
29
36
)
You can’t perform that action at this time.
0 commit comments