manifest/nuxt/stores/strani.js

18 lines
427 B
JavaScript
Raw Normal View History

export const useStraniStore = defineStore('strani', {
state: () => ({
strani: {}
}),
actions: {
async naloziStrani () {
2023-06-15 20:45:38 +02:00
const { jsonApiUrl, headers, deserialize } = useApi()
2023-06-15 20:45:38 +02:00
const data = await $fetch(`${jsonApiUrl}/node/page`, { headers })
this.strani = await deserialize(data, s => ({
id: s.id,
naslov: s.title,
tekst: s.body.processed
}), 'naslov')
}
}
})