-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #586 from open-formulieren/issue/3362-hash-redirects
🐛 Handle server side redirects
- Loading branch information
Showing
3 changed files
with
195 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* Get the correct redirect path for an action. | ||
* @param {string} action The action to be performed. | ||
* @param {Record<string, string>} actionParams The params linked to the action. | ||
* @returns {{path: string, query?: URLSearchParams}} An object containing the pathname to be used, | ||
* alongside with optional query parameters. | ||
*/ | ||
export const getRedirectParams = (action, actionParams) => { | ||
switch (action) { | ||
case 'cosign': | ||
return { | ||
path: 'cosign/check', | ||
query: new URLSearchParams(actionParams), | ||
}; | ||
case 'afspraak-annuleren': | ||
return { | ||
path: 'afspraak-annuleren', | ||
query: new URLSearchParams(actionParams), | ||
}; | ||
case 'afspraak-maken': | ||
return {path: 'afspraak-maken'}; | ||
case 'resume': | ||
return {path: `stap/${actionParams.next_step}`}; | ||
default: | ||
return {}; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters