2023-03-08 23:13:33 +01:00
|
|
|
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()
|
2023-03-08 23:13:33 +01:00
|
|
|
|
2024-04-01 19:59:09 +02:00
|
|
|
const data = await $fetch(`${jsonApiUrl(jezik)}/node/page`, { headers })
|
2023-03-08 23:13:33 +01:00
|
|
|
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 : ''
|
2023-05-03 21:31:01 +02:00
|
|
|
}), 'naslov')
|
2023-03-08 23:13:33 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|