fix(frontend): fixup error handling

This commit is contained in:
MiniDigger | Martin 2022-12-22 18:48:42 +01:00
parent aebd2c5250
commit f44e8449d7

View File

@ -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,
});
}