manifest/nuxt/stores/strani.js

18 lines
411 B
JavaScript
Raw Normal View History

export const useStraniStore = defineStore('strani', {
state: () => ({
strani: {}
}),
actions: {
async naloziStrani () {
const { baseUrl, headers, deserialize } = useApi()
const data = await $fetch(`${baseUrl}/node/page`, { headers })
this.strani = await deserialize(data, s => ({
id: s.id,
naslov: s.title,
tekst: s.body.processed
}))
}
}
})