Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1459 from ithaka/fix/routing-checks
Browse files Browse the repository at this point in the history
Update routing check to catch more cases
  • Loading branch information
daneah authored Jul 10, 2024
2 parents 2a531e2 + ceafade commit 6112adf
Showing 1 changed file with 13 additions and 17 deletions.
30 changes: 13 additions & 17 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,26 +112,22 @@ fetch('/unfederated-session-service/query', {

const currentRequest = window.location.href;

if (currentRequest.includes('/#/')) {
const params = new URLSearchParams({ artstorPath: currentRequest }).toString();
const params = new URLSearchParams({ artstorPath: currentRequest }).toString();

fetch(`/get-the-redirect-please/?${params}`)
.then(redirectResponse => redirectResponse.json())
.then(redirectData => {
if (redirectData.location) {
if (doRedirect) {
console.log('Redirecting to:', redirectData.location);
window.location.replace(redirectData.location);
} else {
console.log('Will eventually redirect to:', redirectData.location);
initializeApp();
}
fetch(`/get-the-redirect-please/?${params}`)
.then(redirectResponse => redirectResponse.json())
.then(redirectData => {
if (redirectData.location) {
if (doRedirect) {
console.log('Redirecting to:', redirectData.location);
window.location.replace(redirectData.location);
} else {
console.log('Will eventually redirect to:', redirectData.location);
initializeApp();
}
});
} else {
initializeApp();
}
} else {
initializeApp();
}
});
});
});

0 comments on commit 6112adf

Please sign in to comment.