manifest/nuxt/components/DodajPojem.vue

27 lines
594 B
Vue
Raw Normal View History

<script setup="setup">
const { etherpadApiUrl, etherpadPrefix } = useRuntimeConfig().public
const prikazi = ref(false)
const revisionId = ref(null)
const dodajPojem = async () => {
revisionId.value = crypto.randomUUID()
// Ustvari nov, prazen pad
const padId = etherpadPrefix + revisionId.value
const resp = await $fetch(`${etherpadApiUrl}/createPad?padID=${padId}&text=`)
prikazi.value = true
}
</script>
2023-06-15 20:45:38 +02:00
<template>
<div>
<div class="gumb" @click="dodajPojem()">
2023-06-15 20:45:38 +02:00
Dodaj pojem
</div>
<PojemForm v-if="prikazi" :revisionId="revisionId" />
</div>
2023-06-15 20:45:38 +02:00
</template>