forked from verdnatura/salix-front
refs #5989 getUrl
This commit is contained in:
parent
a79ae24423
commit
bf256574c9
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue