manifest/nuxt/components/PojemForm.vue

52 lines
1.2 KiB
Vue
Raw Normal View History

2023-06-15 20:45:38 +02:00
<script setup="setup">
const { etherFetch } = useEtherpadApi()
2023-06-15 20:45:38 +02:00
const store = usePojmiStore()
const props = defineProps({
revisionId: String,
pojem: Object,
urejanje: Object
2023-06-15 20:45:38 +02:00
})
let naslov = ref(props.pojem.naslov)
let email = ref('')
const oddajPredlog = async data => {
// @TODO vsebina pada v tekst, testirat
const resp = await etherFetch('/getText', { padID: props.revisionId })
store.ustvariPojem({
title: naslov.value,
email: email.value,
text: resp.data.text,
uuid: props.revisionId
})
alert("sprememba predlagana!")
// @TODO vrni urejanje v navaden prikaz, ko je končano!
urejanje.set(false)
2023-06-15 20:45:38 +02:00
}
const etherNalozen = ev => {
window.location.hash = props.revisionId
}
2023-06-15 20:45:38 +02:00
</script>
<template>
<section class="pojem">
<form class="pojem" @submit.prevent="oddajPredlog">
<label for="naslov">Naslov</label>
<input name="naslov" type="text" v-model="naslov">
<label for="tekst">Besedilo</label>
<EtherpadTextarea :onLoad="etherNalozen" :revisionId="props.revisionId" />
2023-06-15 20:45:38 +02:00
<label for="email">E-poštni naslov</label>
<input name="email" type="email" v-model="email">
<input type="submit" value="Predlagaj">
</form>
</section>
</template>