Fix login redirect to remember current page (#989)

This commit is contained in:
WithoutPants
2020-12-13 14:00:01 +11:00
committed by GitHub
parent 4a08bd351a
commit 931d3a0974
2 changed files with 6 additions and 1 deletions

View File

@@ -10,3 +10,6 @@
* Use natural sort for titles and movie names.
* Support optional preview and sprite generation during scanning.
* Support configurable number of threads for scanning and generation.
### 🐛 Bug fixes
* Fixed login redirect to remember the current page.

View File

@@ -113,7 +113,9 @@ export const createClient = () => {
// handle unauthorized error by redirecting to the login page
if (networkError && (networkError as ServerError).statusCode === 401) {
// redirect to login page
window.location.href = "/login";
const newURL = new URL("/login", window.location.toString());
newURL.searchParams.append("returnURL", window.location.href);
window.location.href = newURL.toString();
}
});