Redirect to the first available page or out of XB when deleting the current page
Closes #3507335
This issue
- redirects the user to the first available page on deletion
- added a todo comment to redirect to the site's homepage instead in https://www.drupal.org/i/3503412, when the 'homepage' property is added the page object that the frontend will be able to check.
- if a user deletes the current and last page, then it will redirect outside of XB back to '/' drupal site
- added a todo comment to remove that after https://www.drupal.org/i/3506434 is in, since that issue will disallow deleting the homepage.
- added a timeout to
window.location.href
redirects. This is necessary because RTK throws an error because it tries to make a request following cache invalidation while
the window.location.href is in progress. The window.location.href is a temporary solution until https://www.drupal.org/i/3502887 is done, then we can hopefully remove the timeouts by using routing hooks instead - created
drupal-globals.ts
file and added baseUrl there from this draft MR- Also opened https://www.drupal.org/project/experience_builder/issues/3521811 where we will refactor everywhere to use the drupal-globals.ts file isntead
Edited by Harumi Jang