0
0
Fork 0

ref #5989 redirection button

This commit is contained in:
Carlos Satorres 2023-08-02 13:37:00 +02:00
parent af36a5bfdd
commit a79ae24423
1 changed files with 6 additions and 18 deletions

View File

@ -19,26 +19,14 @@ onMounted(() => stateStore.setMounted());
function redirect(id) { function redirect(id) {
const currentURL = window.location.href; const currentURL = window.location.href;
const salixBaseURL = 'https://salix.verdnatura.es/#!/'; const salixBaseURL = 'https://salix.verdnatura.es/#!/';
const routeRegex = /\/#\/(\w+)(?:\/(\d+))?/;
const dashboardRegex = /\/#\/dashboard/; const match = currentURL.match(routeRegex);
const claimRegex = /\/#\/claim\/(\d+)\/summary/; if (match) {
const invoiceOutRegex = /\/#\/invoice-out\/(\d+)\/summary/; const [, element, number] = match;
const redirectURL =
if (currentURL.match(dashboardRegex)) { salixBaseURL + (number ? `${element}/${number}/summary` : `${element}/index`);
window.location.href = salixBaseURL;
} else if (currentURL.match(claimRegex)) {
const claimID = currentURL.match(claimRegex)[1];
const redirectURL = salixBaseURL + `claim/${claimID}/summary`;
window.location.href = redirectURL;
} else if (currentURL.match(invoiceOutRegex)) {
const invoiceOutID = currentURL.match(invoiceOutRegex)[1];
const redirectURL = salixBaseURL + `invoice-out/${invoiceOutID}/summary`;
window.location.href = redirectURL; window.location.href = redirectURL;
} else { } else {
window.location.href = salixBaseURL; window.location.href = salixBaseURL;