18 lines
439 B
JavaScript
18 lines
439 B
JavaScript
export const useStraniStore = defineStore('strani', {
|
|
state: () => ({
|
|
strani: {}
|
|
}),
|
|
actions: {
|
|
async naloziStrani (jezik) {
|
|
const { jsonApiUrl, headers, deserialize } = useApi()
|
|
|
|
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')
|
|
}
|
|
}
|
|
})
|