fastify / fastify-dx

Archived
901 stars 42 forks source link

cannot use the "usePayload" hook on fastify-vite-vue #10

Closed davidmeirlevy closed 2 years ago

davidmeirlevy commented 2 years ago

on the the previous version, i use the usePayload as described in the docs:

import {usePayload} from 'fastify-vite-vue/core';

export default {
  components: {},
  setup() {
    const myData = usePayload()
    /// doing something..
    return {myData}
  }
}

on the new version I tried to import usePayload from both: fastify-vite-vue/blueprint/entry/core and /entry/core

both returned the same error:

ℹ at render (/my-app/node_modules/fastify-vite-vue/render.js:7:13) ℹ at Object. (/my-app/node_modules/fastify-vite/mode/development.js:72:24) ℹ at preHandlerCallback (/my-app/node_modules/fastify/lib/handleRequest.js:126:28) ℹ at next (/my-app/node_modules/fastify/lib/hooks.js:158:7) ℹ at handleResolve (/my-appnode_modules/fastify/lib/hooks.js:175:5) ℹ at processTicksAndRejections (node:internal/process/task_queues:96:5)

is there a new way to use the payload behavior now?

galvez commented 2 years ago

Oh yeah, lots of new changes to be documented there.

I think right now it's import { usePayload } from '/entry/core but will double check.

davidmeirlevy commented 2 years ago

@galvez i imported from where you say, and the error you see is from it.

galvez commented 2 years ago

Ah, sorry, missed it — will look into it!

davidmeirlevy commented 2 years ago

@galvez Also, it seems weird that the actual implementation of "usePayload" is hard-copied into my project, instead of use it from the dependency.

galvez commented 2 years ago

This is fixed in the Fastify DX for Vue (wrapping up!), closing this as it pertains to an outdated API.