18 lines
421 B
JavaScript
18 lines
421 B
JavaScript
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
|
|
}), 'naslov')
|
|
}
|
|
}
|
|
})
|