This commit is contained in:
parent
ac7462ec67
commit
b1cb9288df
|
@ -17,26 +17,16 @@ const user = state.getUser();
|
||||||
const token = session.getToken();
|
const token = session.getToken();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
|
||||||
onMounted(() => stateStore. setMounted());
|
onMounted(() => stateStore.setMounted());
|
||||||
|
|
||||||
async function redirect() {
|
async function redirect() {
|
||||||
const currentURL = window.location.href;
|
let section = route.path.substring(1);
|
||||||
const routeRegex = /\/(\w+)(?:\/(\d+))?/;
|
if (!route.path.includes('/')) return (window.location.href = await getUrl(section));
|
||||||
const match = currentURL.match(routeRegex);
|
section = section.substring(0, section.indexOf('/'));
|
||||||
const [, element, number] = match;
|
|
||||||
console.log(route.path);
|
|
||||||
const section = route.path.substring(route.path.indexOf('/'));
|
|
||||||
console.log(section);
|
|
||||||
if (route?.params?.id) {
|
if (route?.params?.id) {
|
||||||
// const redirectURL =
|
window.location.href = await getUrl(`${section}/${route.params.id}/summary`);
|
||||||
// getUrl() + (number ? `${element}/${number}/summary` : `${element}/index`);
|
|
||||||
// window.location.href = redirectURL;
|
|
||||||
console.log(await getUrl(section));
|
|
||||||
window.location.href = await getUrl(section + route.params);
|
|
||||||
} else {
|
} else {
|
||||||
console.log(await getUrl(section));
|
window.location.href = await getUrl(section + '/index');
|
||||||
|
|
||||||
// window.location.href = await getUrl('claim');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue