Prevent hard navigating to the same URL with redirects in api responses.

master
Thomas Lynch 2 months ago
parent 6b516088c8
commit 4665c63de0
  1. 3
      api.js

@ -159,6 +159,9 @@ export async function ApiCall(route, method='get', body, dispatch, errorCallback
if (contentType.startsWith('application/json;')) {
response = await response.json();
if (response.redirect) {
if (router.asPath === response.redirect) {
return;
}
return router.push(response.redirect, null, { scroll: false });
} else if (response.error) {
errorCallback(response.error);

Loading…
Cancel
Save