Skip to content

Commit

Permalink
fix: after merge route
Browse files Browse the repository at this point in the history
  • Loading branch information
martabal committed Oct 14, 2024
1 parent b852468 commit 096179c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions web/src/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export const dateFormats = {

export enum QueryParameter {
ACTION = 'action',
AFTER_MERGE_ROUTE = 'afterMergeRoute',
ID = 'id',
IS_OPEN = 'isOpen',
ONBOARDING_STEP = 'step',
Expand Down
2 changes: 1 addition & 1 deletion web/src/routes/(user)/people/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@
const handleMergePeople = async (detail: PersonResponseDto) => {
await goto(
`${AppRoute.PEOPLE}/${detail.id}?${QueryParameter.ACTION}=${ActionQueryParameterValue.MERGE}&${QueryParameter.PREVIOUS_ROUTE}=${AppRoute.PEOPLE}`,
`${AppRoute.PEOPLE}/${detail.id}?${QueryParameter.ACTION}=${ActionQueryParameterValue.MERGE}&${QueryParameter.PREVIOUS_ROUTE}=${AppRoute.PEOPLE}&${QueryParameter.AFTER_MERGE_ROUTE}=${AppRoute.PEOPLE}`,
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
let viewMode: ViewMode = ViewMode.VIEW_ASSETS;
let isEditingName = false;
let previousRoute: string = AppRoute.EXPLORE;
let afterMergeRoute: string | undefined = undefined;
let people: PersonResponseDto[] = [];
let personMerge1: PersonResponseDto;
let personMerge2: PersonResponseDto;
Expand Down Expand Up @@ -119,6 +120,11 @@
if (getPreviousRoute && !isExternalUrl(getPreviousRoute)) {
previousRoute = getPreviousRoute;
}
const getAfterMergeRoute = $page.url.searchParams.get(QueryParameter.AFTER_MERGE_ROUTE);
if (getAfterMergeRoute && !isExternalUrl(getAfterMergeRoute)) {
afterMergeRoute = getAfterMergeRoute;
}
if (action == 'merge') {
viewMode = ViewMode.MERGE_PEOPLE;
}
Expand Down Expand Up @@ -188,6 +194,10 @@
};
const handleMerge = async (person: PersonResponseDto) => {
if (afterMergeRoute) {
await goto(afterMergeRoute);
return;
}
await updateAssetCount();
await handleGoBack();
Expand Down

0 comments on commit 096179c

Please sign in to comment.