5
5
type AsyncThunkConfig ,
6
6
type PaginationQueryParameters ,
7
7
} from "~/libs/types/types.js" ;
8
+ import { actions as authActions } from "~/modules/auth/auth.js" ;
8
9
import {
9
10
type UserGetAllQueryParameters ,
10
11
type UserGetAllResponseDto ,
@@ -40,7 +41,7 @@ const loadAllByProjectId = createAsyncThunk<
40
41
41
42
const deleteById = createAsyncThunk < boolean , { id : number } , AsyncThunkConfig > (
42
43
`${ sliceName } /delete-by-id` ,
43
- async ( { id } , { extra } ) => {
44
+ async ( { id } , { dispatch , extra } ) => {
44
45
const { projectGroupApi, toastNotifier } = extra ;
45
46
46
47
const isDeleted = await projectGroupApi . deleteById ( id ) ;
@@ -49,6 +50,7 @@ const deleteById = createAsyncThunk<boolean, { id: number }, AsyncThunkConfig>(
49
50
toastNotifier . showSuccess (
50
51
NotificationMessage . PROJECT_GROUP_DELETE_SUCCESS ,
51
52
) ;
53
+ void dispatch ( authActions . getAuthenticatedUser ( ) ) ;
52
54
}
53
55
54
56
return isDeleted ;
@@ -59,12 +61,13 @@ const create = createAsyncThunk<
59
61
ProjectGroupGetAllItemResponseDto ,
60
62
ProjectGroupCreateRequestDto ,
61
63
AsyncThunkConfig
62
- > ( `${ sliceName } /create` , async ( payload , { extra } ) => {
64
+ > ( `${ sliceName } /create` , async ( payload , { dispatch , extra } ) => {
63
65
const { projectGroupApi, toastNotifier } = extra ;
64
66
65
67
const response = await projectGroupApi . create ( payload ) ;
66
68
67
69
toastNotifier . showSuccess ( NotificationMessage . PROJECT_GROUP_CREATE_SUCCESS ) ;
70
+ void dispatch ( authActions . getAuthenticatedUser ( ) ) ;
68
71
69
72
return response ;
70
73
} ) ;
@@ -73,12 +76,13 @@ const patch = createAsyncThunk<
73
76
ProjectGroupGetAllItemResponseDto ,
74
77
{ id : number ; payload : ProjectGroupPatchRequestDto } ,
75
78
AsyncThunkConfig
76
- > ( `${ sliceName } /update` , async ( { id, payload } , { extra } ) => {
79
+ > ( `${ sliceName } /update` , async ( { id, payload } , { dispatch , extra } ) => {
77
80
const { projectGroupApi, toastNotifier } = extra ;
78
81
79
82
const response = await projectGroupApi . patch ( id , payload ) ;
80
83
81
84
toastNotifier . showSuccess ( NotificationMessage . PROJECT_GROUP_UPDATE_SUCCESS ) ;
85
+ void dispatch ( authActions . getAuthenticatedUser ( ) ) ;
82
86
83
87
return response ;
84
88
} ) ;
0 commit comments