manifest/nuxt/stores/pojmi.js

19 lines
449 B
JavaScript

export const usePojmiStore = defineStore('pojmi', {
state: () => ({
pojmi: {}
}),
actions: {
async naloziPojme () {
const { baseUrl, headers, deserialize } = useApi()
const data = await $fetch(`${baseUrl}/node/concept`, { headers })
this.pojmi = await deserialize(data, s => ({
id: s.id,
naslov: s.title,
tekst: s.body.processed,
media: s.field_media
}), 'naslov')
}
}
})