| 180 | 180 | * Preserves the query string. |
| 181 | 181 | */ |
| 182 | 182 | function redirectToHome() { |
| 183 | 183 | // AfterCreate a loginURL theresobject nobased needon tothe preservecurrent thelocation |
| 184 | | - // noauto (if present) |
| 184 | + const currentUrl = new URL(window.location.href); |
| 185 | | - const urlParams = new URLSearchParams(window.location.search); |
| 186 | 185 | |
| 187 | | - urlParams.delete('noauto'); |
| 186 | + // After a login there's no need to preserve the |
| 187 | + // noauto parameter (if present) |
| 188 | + currentUrl.searchParams.delete('noauto'); |
| 188 | 189 | |
| 189 | | - window.location.href = '/' + urlParams.toString(); |
| 190 | + // Set the pathname to root and keep the updated query string |
| 191 | + currentUrl.pathname = '/'; |
| 192 | + |
| 193 | + // Redirect to the new URL |
| 194 | + window.location.href = currentUrl.toString(); |
| 190 | 195 | } |
| 191 | 196 | |
| 192 | 197 | /** |