Skip to content

Commit 74dc2fc

Browse files
authored
case file - linked case file - auto refresh (#566)
1 parent dde2456 commit 74dc2fc

File tree

5 files changed

+17
-7
lines changed

5 files changed

+17
-7
lines changed

compliance-web/src/components/App/CaseFiles/Profile/CaseFileActions.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
useUnlinkCaseFile,
1010
useUpdateCaseFileStatus,
1111
} from "@/hooks/useCaseFiles";
12-
import { CaseFile } from "@/models/CaseFile";
12+
import { CaseFile, CaseFileLink } from "@/models/CaseFile";
1313
import { useModal } from "@/store/modalStore";
1414
import { notify } from "@/store/snackbarStore";
1515
import { useQueryClient } from "@tanstack/react-query";
@@ -53,10 +53,13 @@ const CaseFileActions: React.FC<CaseFileActionsProps> = ({
5353
closeAndRefresh();
5454
}, [closeAndRefresh]);
5555

56-
const onLinkCaseFileSuccess = useCallback(() => {
56+
const onLinkCaseFileSuccess = useCallback((response: CaseFileLink) => {
5757
notify.success("Case file link is updated");
5858
closeAndRefresh();
59-
}, [closeAndRefresh]);
59+
queryClient.invalidateQueries({
60+
queryKey: ["case-file", response?.target?.case_file_number],
61+
});
62+
}, [closeAndRefresh, queryClient]);
6063

6164
const onDeleteSuccess = useCallback(() => {
6265
notify.success("Case File deleted!");

compliance-web/src/components/Shared/Header/EAOAppBar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ const EAOAppBar = forwardRef<HTMLDivElement, EAOAppBarProps>((_props, ref) => {
104104
<Button
105105
variant="outlined"
106106
color="inherit"
107-
onClick={() => auth.signinRedirect()}
107+
onClick={() => auth.signinRedirect({ extraQueryParams: { kc_idp_hint: "idir" } })}
108108
>
109109
Sign In
110110
</Button>

compliance-web/src/models/CaseFile.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,9 @@ export interface CaseFileOption {
7474
id: number;
7575
name: string;
7676
}
77+
export interface CaseFileLink {
78+
id: number;
79+
source: CaseFile;
80+
target: CaseFile;
81+
}
7782

compliance-web/src/routes/_authenticated.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function Auth() {
1111

1212
useEffect(() => {
1313
if (!isAuthenticated && !isLoading) {
14-
signinRedirect();
14+
signinRedirect({ extraQueryParams: { kc_idp_hint: "idir" } });
1515
}
1616
}, [isAuthenticated, isLoading, signinRedirect]);
1717

compliance-web/src/utils/config.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,13 @@ export const AppConfig = {
5151
export const OidcConfig = {
5252
authority: OIDC_AUTHORITY,
5353
client_id: CLIENT_ID,
54-
kc_idp_hint: "idir",
55-
redirect_uri: `${APP_URL}/oidc-callback?kc_idp_hint=idir`,
54+
redirect_uri: `${APP_URL}/oidc-callback`,
5655
post_logout_redirect_uri: `${APP_URL}/`,
5756
scope: "openid profile email",
5857
response_type: "code",
5958
automaticSilentRenew: false,
6059
revokeTokensOnSignout: true,
60+
extraQueryParams: {
61+
kc_idp_hint: "idir"
62+
},
6163
};

0 commit comments

Comments
 (0)