manifest/nuxt/stores/strani.js

18 lines
439 B
JavaScript
Raw Normal View History

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