Skip to content

Commit e8a9d1f

Browse files
authored
fix: update auth user permissions after project group deleted gf-585 (#586)
1 parent 2c82f82 commit e8a9d1f

File tree

1 file changed

+7
-3
lines changed
  • apps/frontend/src/modules/project-groups/slices

1 file changed

+7
-3
lines changed

apps/frontend/src/modules/project-groups/slices/actions.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
type AsyncThunkConfig,
66
type PaginationQueryParameters,
77
} from "~/libs/types/types.js";
8+
import { actions as authActions } from "~/modules/auth/auth.js";
89
import {
910
type UserGetAllQueryParameters,
1011
type UserGetAllResponseDto,
@@ -40,7 +41,7 @@ const loadAllByProjectId = createAsyncThunk<
4041

4142
const deleteById = createAsyncThunk<boolean, { id: number }, AsyncThunkConfig>(
4243
`${sliceName}/delete-by-id`,
43-
async ({ id }, { extra }) => {
44+
async ({ id }, { dispatch, extra }) => {
4445
const { projectGroupApi, toastNotifier } = extra;
4546

4647
const isDeleted = await projectGroupApi.deleteById(id);
@@ -49,6 +50,7 @@ const deleteById = createAsyncThunk<boolean, { id: number }, AsyncThunkConfig>(
4950
toastNotifier.showSuccess(
5051
NotificationMessage.PROJECT_GROUP_DELETE_SUCCESS,
5152
);
53+
void dispatch(authActions.getAuthenticatedUser());
5254
}
5355

5456
return isDeleted;
@@ -59,12 +61,13 @@ const create = createAsyncThunk<
5961
ProjectGroupGetAllItemResponseDto,
6062
ProjectGroupCreateRequestDto,
6163
AsyncThunkConfig
62-
>(`${sliceName}/create`, async (payload, { extra }) => {
64+
>(`${sliceName}/create`, async (payload, { dispatch, extra }) => {
6365
const { projectGroupApi, toastNotifier } = extra;
6466

6567
const response = await projectGroupApi.create(payload);
6668

6769
toastNotifier.showSuccess(NotificationMessage.PROJECT_GROUP_CREATE_SUCCESS);
70+
void dispatch(authActions.getAuthenticatedUser());
6871

6972
return response;
7073
});
@@ -73,12 +76,13 @@ const patch = createAsyncThunk<
7376
ProjectGroupGetAllItemResponseDto,
7477
{ id: number; payload: ProjectGroupPatchRequestDto },
7578
AsyncThunkConfig
76-
>(`${sliceName}/update`, async ({ id, payload }, { extra }) => {
79+
>(`${sliceName}/update`, async ({ id, payload }, { dispatch, extra }) => {
7780
const { projectGroupApi, toastNotifier } = extra;
7881

7982
const response = await projectGroupApi.patch(id, payload);
8083

8184
toastNotifier.showSuccess(NotificationMessage.PROJECT_GROUP_UPDATE_SUCCESS);
85+
void dispatch(authActions.getAuthenticatedUser());
8286

8387
return response;
8488
});

0 commit comments

Comments
 (0)