replace route when redirecting to platform version

Fixes #714
This commit is contained in:
Jake Potrebic 2022-06-20 13:44:36 -07:00
parent 29a06466b1
commit 2bbfc7b97b
No known key found for this signature in database
GPG Key ID: 27CC63F7CBC866C7
4 changed files with 8 additions and 7 deletions

View File

@ -92,6 +92,10 @@ const navBarMenuLinksHangar = [
{ link: "staff", label: "Team", icon: IconMdiAccountGroup },
];
const auth = useAuth;
const authHost = import.meta.env.HANGAR_AUTH_HOST;
authLog("render with user " + authStore.user?.name);
const navBarMenuLinksMoreFromPaper = [
{ link: "https://papermc.io/", label: t("nav.hangar.home"), icon: IconMdiHome },
{ link: "https://forums.papermc.io/", label: t("nav.hangar.forums"), icon: IconMdiForum },
@ -100,13 +104,9 @@ const navBarMenuLinksMoreFromPaper = [
{ link: "https://papermc.io/javadocs", label: t("nav.hangar.javadocs"), icon: IconMdiLanguageJava },
{ link: "https://papermc.io/downloads", label: t("nav.hangar.downloads"), icon: IconMdiDownloadCircle },
{ link: "https://papermc.io/community", label: t("nav.hangar.community"), icon: IconMdiAccountGroup },
{ link: "https://hangar-auth.benndorf.dev/", label: t("nav.hangar.auth"), icon: IconMdiKey },
{ link: authHost, label: t("nav.hangar.auth"), icon: IconMdiKey },
];
const auth = useAuth;
const authHost = import.meta.env.HANGAR_AUTH_HOST;
authLog("render with user " + authStore.user?.name);
function markNotificationsRead() {
for (const notification of notifications.value) {
markNotificationRead(notification);

View File

@ -18,6 +18,7 @@ const props = defineProps<{
maxlength?: number;
loading?: boolean;
errorMessages?: string[];
disabled?: boolean;
rules?: ValidationRule<string | undefined>[];
}>();

View File

@ -88,7 +88,7 @@ export async function useProjectVersions(user: string, project: string, blocking
export async function useProjectVersionsInternal(user: string, project: string, version: string, blocking = true) {
return useInitialState(
"useProjectVersions",
"useProjectVersionsInternal",
() => useInternalApi<HangarVersion[]>(`versions/version/${user}/${project}/versions/${version}`, false),
blocking
);

View File

@ -44,7 +44,7 @@ if (!route.params.platform) {
path = path.substring(0, path.length - 1);
}
const entry = versionMap.keys().next();
await (entry.value ? useRouter().push({ path: `${path}/${entry.value.toLowerCase()}` }) : useRouter().push(useErrorRedirect(route, 404, "Not found")));
await (entry.value ? useRouter().replace({ path: `${path}/${entry.value.toLowerCase()}` }) : useRouter().push(useErrorRedirect(route, 404, "Not found")));
}
useHead(