mirror of
https://github.com/HangarMC/Hangar.git
synced 2025-03-07 15:31:00 +08:00
fix(frontend): fixup error handling
This commit is contained in:
parent
aebd2c5250
commit
f44e8449d7
@ -1,17 +1,9 @@
|
||||
import { RouteLocationNamedRaw, RouteLocationNormalized } from "vue-router";
|
||||
import { createError } from "#imports";
|
||||
|
||||
export function useErrorRedirect(currentRoute: RouteLocationNormalized, status: number, msg?: string): RouteLocationNamedRaw {
|
||||
return {
|
||||
name: "error",
|
||||
params: {
|
||||
// Match the path of your current page and keep the same url...
|
||||
pathMatch: currentRoute.path.split("/").slice(1),
|
||||
// pass other params
|
||||
status,
|
||||
msg,
|
||||
},
|
||||
// ...and the same query and hash.
|
||||
query: currentRoute.query,
|
||||
hash: currentRoute.hash,
|
||||
};
|
||||
throw createError({
|
||||
status,
|
||||
message: msg,
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user