fix(ui): prevent exceptions on other users' repo migration pages
- don't expect the retry button to always be attached - don't parse status response as JSON when it was a login redirect - add E2E test
This commit is contained in:
parent
e3243a9465
commit
a4814bca2d
2 changed files with 34 additions and 1 deletions
|
@ -7,13 +7,14 @@ export function initRepoMigrationStatusChecker() {
|
|||
const repoMigrating = document.getElementById('repo_migrating');
|
||||
if (!repoMigrating) return;
|
||||
|
||||
document.getElementById('repo_migrating_retry').addEventListener('click', doMigrationRetry);
|
||||
document.getElementById('repo_migrating_retry')?.addEventListener('click', doMigrationRetry);
|
||||
|
||||
const task = repoMigrating.getAttribute('data-migrating-task-id');
|
||||
|
||||
// returns true if the refresh still needs to be called after a while
|
||||
const refresh = async () => {
|
||||
const res = await GET(`${appSubUrl}/user/task/${task}`);
|
||||
if (res.url.endsWith('/login')) return false; // stop refreshing if redirected to login
|
||||
if (res.status !== 200) return true; // continue to refresh if network error occurs
|
||||
|
||||
const data = await res.json();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue