refs #5989 getUrl
gitea/salix-front/pipeline/head This commit looks good Details

This commit is contained in:
Carlos Satorres 2023-08-03 09:41:26 +02:00
parent a79ae24423
commit bf256574c9
1 changed files with 4 additions and 5 deletions

View File

@ -6,6 +6,7 @@ import UserPanel from 'components/UserPanel.vue';
import { useState } from 'src/composables/useState';
import { useStateStore } from 'stores/useStateStore';
import PinnedModules from './PinnedModules.vue';
import { getUrl } from 'src/composables/getUrl';
const { t } = useI18n();
const session = useSession();
@ -13,23 +14,21 @@ const stateStore = useStateStore();
const state = useState();
const user = state.getUser();
const token = session.getToken();
const appName = 'Lilium';
onMounted(() => stateStore.setMounted());
function redirect(id) {
function redirect() {
const currentURL = window.location.href;
const salixBaseURL = 'https://salix.verdnatura.es/#!/';
const routeRegex = /\/#\/(\w+)(?:\/(\d+))?/;
const match = currentURL.match(routeRegex);
if (match) {
const [, element, number] = match;
const redirectURL =
salixBaseURL + (number ? `${element}/${number}/summary` : `${element}/index`);
getUrl() + (number ? `${element}/${number}/summary` : `${element}/index`);
window.location.href = redirectURL;
} else {
window.location.href = salixBaseURL;
window.location.href = getUrl();
}
}
</script>