Website Structure
This commit is contained in:
parent
62812f2090
commit
71f0676a62
22365 changed files with 4265753 additions and 791 deletions
23
Frontend-Learner/node_modules/nuxt/dist/pages/runtime/validate.js
generated
vendored
Normal file
23
Frontend-Learner/node_modules/nuxt/dist/pages/runtime/validate.js
generated
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import { createError } from "#app/composables/error";
|
||||
import { defineNuxtRouteMiddleware } from "#app/composables/router";
|
||||
export default defineNuxtRouteMiddleware(async (to, from) => {
|
||||
if (!to.meta?.validate) {
|
||||
return;
|
||||
}
|
||||
const result = await Promise.resolve(to.meta.validate(to));
|
||||
if (result === true) {
|
||||
return;
|
||||
}
|
||||
const error = createError({
|
||||
fatal: import.meta.client,
|
||||
statusCode: result && result.statusCode || 404,
|
||||
statusMessage: result && result.statusMessage || `Page Not Found: ${to.fullPath}`,
|
||||
data: {
|
||||
path: to.fullPath
|
||||
}
|
||||
});
|
||||
if (typeof window !== "undefined") {
|
||||
window.history.pushState({}, "", from.fullPath);
|
||||
}
|
||||
return error;
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue