Closed rasmuslian closed 1 year ago
Hey hey,
The first problem you mentioned is TS related, dont need to worry about that :)
The second one I am more concerned.
Could you show me how are you using the event handler registered hereserver/api/products/index.ts
?
Are you using useFetch
or something else?
Hey hey,
The first problem you mentioned is TS related, dont need to worry about that :)
The second one I am more concerned.
Could you show me how are you using the event handler registered here
server/api/products/index.ts
?Are you using
useFetch
or something else?
Regarding the first problem, I know even though it's nothing tto worry about it would be nice with the types working so to use code completion inside VS code.
As to the second one, this is how I'm using it, inside a file called pages/shop/index.vue
<script setup lang="ts" scoped>
const { data: products } = await useFetch("/api/products");
</script>
The first problem wont be so easy to solve as this type of declaration is a recurring situation in several modules.
The second problem. Why are you using scoped on the script tag? I dont think it is needed :)
The first problem wont be so easy to solve as this type of declaration is a recurring situation in several modules.
The second problem. Why are you using scoped on the script tag? I dont think it is needed :)
The scoped tag got added there accidentally, removed it now and still same error! :)
@rasmuslian
Could you create a stackblitz link with reproduction? This is really strange
@rasmuslian
Could you create a stackblitz link with reproduction? This is really strange
Here is a stackblitz I created now: https://stackblitz.com/edit/nuxt-starter-ezqx4d (Obviously without an medusa backend within the Stack Blitz project)
I see.
Thanks for that. I know where the problem is. This is really strange one. I will publish a new version in the upcoming hours that should fix that :)
I see.
Thanks for that. I know where the problem is. This is really strange one. I will publish a new version in the upcoming hours that should fix that :)
Awesome! Let me know also, would be interesting to know what caused this problem.
Hey, can you try the 0.3.4 version? It should be working there. I also need to correct the docs :)
Hey, can you try the 0.3.4 version? It should be working there. I also need to correct the docs :)
It's working now with version 0.3.4! :) What was the issue?
The issue was really strange. It was caused by the transpilation of the axios dependency and as a result it was merging the medusa client with Axios.
With 0.3.4 you should also have the type delcaration for server utility.
I am closing the issue then. Thanks for the help! 💚
The issue was really strange. It was caused by the transpilation of the axios dependency and as a result it was merging the medusa client with Axios.
With 0.3.4 you should also have the type delcaration for server utility.
I am closing the issue then. Thanks for the help! 💚
Very peculiar! Thank you for the elaboration, and not the least the updated module version! Keep up the good work 😄
Version
nuxt-medusa ^0.3.2 nuxt: ^3.2.3
Steps to reproduce
Nuxt config:
What is Expected?
That
serverMedusaClient
can be used as in the documentation in server routes.What is actually happening?
Using this code within 'server/api/products/index.ts'
Gives this result:
import { serverMedusaClient } from '#medusa/server'
shows the error: "Cannot find module '#medusa/server' or its corresponding type declarations"It seems that it cannot find the type declarations, but not only that, when using it (ignoring this error, since it should only by typescript related) I get the following error:
Using
useMedusaClient
works like expected.