Skip to content

Commit

Permalink
fix(ts): remove redirect when on correct page
Browse files Browse the repository at this point in the history
  • Loading branch information
Gusted committed Aug 8, 2021
1 parent 0f12e47 commit 1540f39
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions typescript/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ function pageSpecificFunctions(settings: UserSettings) {
saveRedirect();
break;
case '/account':
case '/api/oauth/style/link':
checkRedirect(settings.redirect);
break;
}
Expand Down
4 changes: 3 additions & 1 deletion typescript/page/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import {storeNewSettings} from 'utils/storage';
export function checkRedirect(redirect: string) {
if (redirect) {
storeNewSettings({redirect: ''});
window.location.href = window.location.origin + redirect;
if (window.location.href !== redirect) {
window.location.href = redirect;
}
}
}

0 comments on commit 1540f39

Please sign in to comment.