We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I have been using this pakcage for my vue2 project without nuxt. But I tried to use it in my nuxt3 project. But I couldn't be able to run the package.
plugin/apiFetch.ts: `import { defineNuxtPlugin } from '#app' import Cookies from 'js-cookie'
export default defineNuxtPlugin(nuxtApp => { const config = useRuntimeConfig()
let token =Cookies.get('TOKEN');//'49|VKVPHxftNkveptKUy9lBP5OQtnqQXWsWOjzFOeym'
const headers = { Authorization: Bearer ${token}, Accept: 'application/json', 'X-XSRF-TOKEN': Cookies.get('XSRF-TOKEN'), } nuxtApp.provide( 'apiFetch', $fetch.create({ baseURL: config.BASE_URL, credentials: 'include', headers: headers, }) ) })`
Bearer ${token}
How can i use form.post in my component? I used this:
`const { $apiFetch } = useNuxtApp()
const form = reactive( { leave_reason: null, } ) async function apply() { // const rr = await $apiFetch('/leave/apply-leave', {method: 'POST'}) const response = await this.form.post('/leave/apply-leave')
//this.form=rr;
}`
But not worked. Anyone here to help?
The text was updated successfully, but these errors were encountered:
Can you try this?
const form = reactive(new Form({ leave_reason: null, }) )
and instead of this.form.post
this.form.post
just use form.post
form.post
Sorry, something went wrong.
No branches or pull requests
I have been using this pakcage for my vue2 project without nuxt.
But I tried to use it in my nuxt3 project. But I couldn't be able to run the package.
plugin/apiFetch.ts:
`import { defineNuxtPlugin } from '#app'
import Cookies from 'js-cookie'
export default defineNuxtPlugin(nuxtApp => {
const config = useRuntimeConfig()
let token =Cookies.get('TOKEN');//'49|VKVPHxftNkveptKUy9lBP5OQtnqQXWsWOjzFOeym'
const headers = {
Authorization:
Bearer ${token}
,Accept: 'application/json',
'X-XSRF-TOKEN': Cookies.get('XSRF-TOKEN'),
}
nuxtApp.provide(
'apiFetch',
$fetch.create({
baseURL: config.BASE_URL,
credentials: 'include',
headers: headers,
})
)
})`
How can i use form.post in my component? I used this:
`const { $apiFetch } = useNuxtApp()
//this.form=rr;
But not worked. Anyone here to help?
The text was updated successfully, but these errors were encountered: