manifest/nuxt/stores/strani.js

18 lines
453 B
JavaScript
Raw Permalink 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,
2024-06-14 13:45:13 +02:00
tekst: s.body ? s.body.processed : ''
}), 'naslov')
}
}
})