File tree Expand file tree Collapse file tree 6 files changed +2
-147
lines changed
backend/src/packages/users Expand file tree Collapse file tree 6 files changed +2
-147
lines changed Original file line number Diff line number Diff line change @@ -34,12 +34,6 @@ class UserController extends Controller {
34
34
35
35
this . userService = userService ;
36
36
37
- this . addRoute ( {
38
- path : UsersApiPath . ROOT ,
39
- method : 'GET' ,
40
- handler : ( ) => this . findAll ( ) ,
41
- } ) ;
42
-
43
37
this . addRoute ( {
44
38
path : UsersApiPath . $ID ,
45
39
method : 'GET' ,
@@ -53,33 +47,6 @@ class UserController extends Controller {
53
47
} ) ;
54
48
}
55
49
56
- /**
57
- * @swagger
58
- * /users:
59
- * get:
60
- * description: Returns an array of users
61
- * responses:
62
- * 200:
63
- * description: Successful operation
64
- * content:
65
- * application/json:
66
- * schema:
67
- * type: array
68
- * items:
69
- * $ref: '#/components/schemas/User'
70
- */
71
- private async findAll ( ) : Promise < ApiHandlerResponse > {
72
- const result = await this . userService . findAll ( ) ;
73
-
74
- return {
75
- status : HttpCode . OK ,
76
- payload : {
77
- items : result ,
78
- totalCount : result . length ,
79
- } ,
80
- } ;
81
- }
82
-
83
50
private async findById (
84
51
options : ApiHandlerOptions < {
85
52
params : { id : UserEntityT [ 'id' ] } ;
Original file line number Diff line number Diff line change 1
1
import 'react-toastify/dist/ReactToastify.css' ;
2
2
3
3
import { Header , RouterOutlet } from '~/libs/components/components.js' ;
4
- import { AppRoute } from '~/libs/enums/enums.js' ;
5
- import {
6
- useAppDispatch ,
7
- useAppSelector ,
8
- useEffect ,
9
- useLocation ,
10
- useState ,
11
- } from '~/libs/hooks/hooks.js' ;
4
+ import { useEffect } from '~/libs/hooks/hooks.js' ;
12
5
import { socket as socketService } from '~/libs/packages/socket/socket.js' ;
13
- import { actions as userActions } from '~/slices/users/users.js' ;
14
6
15
7
const App : React . FC = ( ) => {
16
- const { pathname } = useLocation ( ) ;
17
- const dispatch = useAppDispatch ( ) ;
18
- const [ isWebSocketsConnected , setIsWebSocketsConnected ] = useState ( false ) ;
19
- const { users, dataStatus } = useAppSelector ( ( { users } ) => ( {
20
- users : users . users ,
21
- dataStatus : users . dataStatus ,
22
- } ) ) ;
23
-
24
- const isRoot = pathname === AppRoute . ROOT ;
25
-
26
8
useEffect ( ( ) => {
27
9
socketService . connect ( ) ;
28
10
29
- socketService . addListener ( 'CONNECT' , ( ) => {
30
- setIsWebSocketsConnected ( true ) ;
31
- } ) ;
32
-
33
11
return ( ) => {
34
12
socketService . disconnect ( ) ;
35
13
} ;
36
14
} , [ ] ) ;
37
15
38
- useEffect ( ( ) => {
39
- if ( isRoot ) {
40
- void dispatch ( userActions . loadAll ( ) ) ;
41
- }
42
- } , [ isRoot , dispatch ] ) ;
43
-
44
16
return (
45
17
< >
46
18
< Header />
47
- < div >
48
- < RouterOutlet />
49
- </ div >
50
- { isRoot && (
51
- < >
52
- < h2 > Users:</ h2 >
53
- < h3 > Status: { dataStatus } </ h3 >
54
- < h3 >
55
- Socket: { isWebSocketsConnected ? 'connected' : 'disconnected' }
56
- </ h3 >
57
- < ul >
58
- { users . map ( ( it ) => (
59
- < li key = { it . id } > { it . phone } </ li >
60
- ) ) }
61
- </ ul >
62
- </ >
63
- ) }
19
+ < RouterOutlet />
64
20
</ >
65
21
) ;
66
22
} ;
Original file line number Diff line number Diff line change @@ -10,14 +10,12 @@ import { type IConfig } from '~/libs/packages/config/config.js';
10
10
import { authApi } from '~/packages/auth/auth.js' ;
11
11
import { userApi } from '~/packages/users/users.js' ;
12
12
import { reducer as authReducer } from '~/slices/auth/auth.js' ;
13
- import { reducer as usersReducer } from '~/slices/users/users.js' ;
14
13
15
14
import { notification } from '../notification/notification.js' ;
16
15
import { LocalStorage } from '../storage/storage.js' ;
17
16
18
17
type RootReducer = {
19
18
auth : ReturnType < typeof authReducer > ;
20
- users : ReturnType < typeof usersReducer > ;
21
19
} ;
22
20
23
21
type ExtraArguments = {
@@ -41,7 +39,6 @@ class Store {
41
39
devTools : config . ENV . APP . ENVIRONMENT !== AppEnvironment . PRODUCTION ,
42
40
reducer : {
43
41
auth : authReducer ,
44
- users : usersReducer ,
45
42
} ,
46
43
middleware : ( getDefaultMiddleware ) => {
47
44
return getDefaultMiddleware ( {
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments