NuxtN
Nuxt2y ago
Tumulte

registerEndpoint returning data from a previous registerEnpoint

I have 2 end points for a test...

registerEndpoint('/api/channel/preview', {
  method: 'POST',
  handler: () => {
    return { query: 'query', content: posts };
  },
});

registerEndpoint('/api/channel/preview/translator', {
  method: 'POST',
  handler: () => {
    return { prompt: 'new prompt' };
  },
});


but when I call the second enpoint, it gives me the data from the first {query:... content:...}

however if I swap their position in the test code to match the order they are called... it works

I don't understand why the position should matter and the documentation says nothing
Was this page helpful?