refs #5989 btn redirection #69

Merged
alexm merged 19 commits from 5989-redirectSalix into dev 2023-08-09 10:39:54 +00:00
1 changed files with 4 additions and 5 deletions
Showing only changes of commit bf256574c9 - Show all commits

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>