WIP urejanje pojma

Jurij Podgoršek 2023-11-13 00:22:34 +01:00
parent 5837d4cb26
commit 54f0b5b91d
1 changed files with 16 additions and 0 deletions

View File

@ -1,4 +1,7 @@
<script setup="setup">
const { etherpadApiUrl, etherpadPrefix } = useRuntimeConfig().public
const store = usePojmiStore()
const props = defineProps({
@ -6,14 +9,27 @@ const props = defineProps({
})
const pojem = computed(() => store.pojmi[props.naslov])
const revisionId = computed(() => pojem.value.id)
await store.naloziPojme()
const urejanje = ref(false)
const urediPojem = async () => {
// Ustvari pad s tekstom pojma, ce se ne obstaja
const resp = await $fetch(`${etherpadApiUrl}/createPad?padID=${etherpadPrefix + revisionId.value}&text=` + pojem.value.tekst)
urejanje.value = true
}
</script>
<template>
<section class="pojem">
<h2>{{ pojem.naslov }}</h2>
<div class="tekst" v-html="pojem.tekst" />
<div class="gumb" @click="urediPojem">Uredi</div>
<div v-if="urejanje" class="pojem">
<PojemForm :revisionId="revisionId" />
</div>
</section>
</template>