Redirect to another website if missing search params
Hello folks, from our main website we select the items etc and then user clicks on "Proceed" and they navigate to our SPA and we pass some search parameters like IDs, some flags, etc. All of them required, if one of them is missing we should redirect back to the main website they came from.
Currently if the paran validation fails, I just display the general error screen and validate if error.routerCode === "VALIDATE_SEARCH" is true, then redirect the user to our main website.
Is this the better approach? I dont wanna make our general error screen dirty, can I do the redirecting in the beforeLoad or something like that?
1 Reply
flat-fuchsia•9mo ago
yes you can throw a redirect in beforeLoad/loader