Не пойму почему переменная store - undefined
import FormCreate from "@/components/FormCreate.vue"
import FormUser from "@/components/FormUser.vue"
import { defineComponent } from 'vue'
import {postForm} from "@/stores/form"
export default defineComponent({
setup() {
const stores = postForm()
return {stores}
},
methods: {
onLogin(data) {
console.log(this.stores)
}
}
})
postForm - это объект из скрипта form который использует pinia
import { defineStore } from 'pinia'
export const postForm = defineStore('form', {
state: () => ({
form: []
}),
actions: {
postUser(data, site) {
fetch(`http://localhost:5002/api/${site}`, {
method: "POST",
headers: {
'Content-type': "multipart/form-data"
},
body: data
})
.then(res => this.form = res)
},
}
})