Skip to content

Commit

Permalink
Spa module tunning
Browse files Browse the repository at this point in the history
  • Loading branch information
Machy8 committed Sep 29, 2024
1 parent 84ae46a commit 6feb9b1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/signalizejs/src/modules/spa.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ export default async ({ params, resolve, root }, config) => {
/** @type {import('../../types/modules/spa').navigate} */
const navigate = async (data) => {
updateCurrentState();
if (typeof data === 'string') {
data = { url: data };
}

firstNavigationTriggered = true;
/** @type {import('../../types/modules/spa.d.ts').NavigationEventData} */
Expand Down Expand Up @@ -135,11 +138,17 @@ export default async ({ params, resolve, root }, config) => {
Accept: 'text/html, application/xhtml+xml'
}
});

navigationRequestIsRunning = false;
abortNavigationRequestController = undefined;
const requestIsWithoutErroor = navigationResponse.error === null;

if (requestIsWithoutErroor) {
if (navigationResponse.response.redirected) {
window.location = navigationRequestIsRunning.response.url;
return;
}

try {
responseData = navigationResponse.response === null ? '' : await navigationResponse.response.text();
} catch (error) {
Expand Down

0 comments on commit 6feb9b1

Please sign in to comment.