Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Vue Router warn]: No match found for location with path <API URL> #256

Open
enshaded opened this issue Apr 27, 2024 · 2 comments
Open

[Vue Router warn]: No match found for location with path <API URL> #256

enshaded opened this issue Apr 27, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@enshaded
Copy link

enshaded commented Apr 27, 2024

Vue Router warn appears every time I use any of the functions from the nuxt-directus composables.

Version

nuxt-directus: 5.6.1
nuxt: 3.11.2

Steps to reproduce

nuxt.config.ts

// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  devtools: { enabled: true },
  modules: ['nuxt-directus'],
  runtimeConfig: {
    directus: {
      url: "http://localhost:8055"
    }
  }
})

pages/index.vue

<template>
    <span @click="fetchCollections">test</span>
</template>

<script setup lang='ts'>
const { getCollections } = useDirectusCollections();
const router = useRouter();
const fetchCollections = async () => {
  const collections = await getCollections();
};
</script>

What is Expected?

Response from Directus.

What is actually happening?

 WARN  [Vue Router warn]: No match found for location with path "/collections/"
@enshaded enshaded added the bug Something isn't working label Apr 27, 2024
@forge-oscar-caballero
Copy link
Contributor

I'm experiencing the same bug. Items are accessible directly from http://localhost:8055/items/navigation/main-menu but not through nuxt v3.11.2.

const { data: menu } = await useAsyncData("navigation", () =>
  getItemById<NavigationMenu>({
    collection: "navigation",
    id: "main-menu",
  })
); 

I've setup my runtime configuration correctly.

runtimeConfig: {
    directus: {
      url: "http://localhost:8055",
    },
  },
[Vue Router warn]: No match found for location with path "/items/navigation/main-menu"

@forge-oscar-caballero
Copy link
Contributor

@morkvitnir I just notice documentation is outdated for our case:

Screenshot 2024-04-28 at 9 48 46 AM

We need to arrange it inside public to be exposed:

runtimeConfig: {
  public: {
    directus: {
      url: "http://localhost:8055",
    },
  },
},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants