resf #5989 fix(redirect)
gitea/salix-front/pipeline/head This commit looks good Details

This commit is contained in:
Alex Moreno 2023-08-04 08:37:55 +02:00
parent ac7462ec67
commit b1cb9288df
1 changed files with 6 additions and 16 deletions

View File

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