From 12ae40313d50f3df5d37dc4724ba5aeffda0deec Mon Sep 17 00:00:00 2001 From: Julien Huang Date: Sun, 7 May 2023 11:35:27 +0200 Subject: [PATCH] fix: remove useless call and correct fetch body (#14) - make ` nuxt._route.matched[0].path` fallback to `/` (when using only app.vue) - remove useless fetch call to unexisting endpoint --- src/runtime/devtools/init.ts | 1 + src/runtime/plugin.ts | 2 +- src/runtime/view/TheContainer.vue | 12 +----------- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/runtime/devtools/init.ts b/src/runtime/devtools/init.ts index 7253de4..e51d23d 100644 --- a/src/runtime/devtools/init.ts +++ b/src/runtime/devtools/init.ts @@ -81,6 +81,7 @@ export default function initServer (nuxt: Nuxt) { routes: routesCount }) } + return 'ok' }) }) } diff --git a/src/runtime/plugin.ts b/src/runtime/plugin.ts index fb27bdc..50e903a 100644 --- a/src/runtime/plugin.ts +++ b/src/runtime/plugin.ts @@ -14,7 +14,7 @@ export default defineNuxtPlugin((nuxt) => { $fetch('/__hydration_ping', { method: 'POST', body: { - route: nuxt._route.matched[0].path + route: nuxt._route.matched[0]?.path ?? '/' } }) } diff --git a/src/runtime/view/TheContainer.vue b/src/runtime/view/TheContainer.vue index 00a0907..6a0f982 100644 --- a/src/runtime/view/TheContainer.vue +++ b/src/runtime/view/TheContainer.vue @@ -21,24 +21,14 @@