Prazen buffer v novem pojmu, faktoriranje

pull/54/head
Jurij Podgoršek 2024-03-05 22:58:54 +01:00
parent ba4ec35410
commit 1b0f6ab4ed
2 changed files with 6 additions and 3 deletions

View File

@ -1,3 +1,4 @@
// @TODO preimenuj v api.js, dodaj helperje se za json fetch / naš api
export const useEtherpadApi = () => { export const useEtherpadApi = () => {
const { baseUrl } = useRuntimeConfig().public const { baseUrl } = useRuntimeConfig().public
const etherpadApiUrl = `${baseUrl}/etherpad-api` const etherpadApiUrl = `${baseUrl}/etherpad-api`

View File

@ -1,7 +1,7 @@
<script setup="setup"> <script setup="setup">
const { getRandomUUID } = useCrypto() const { getRandomUUID } = useCrypto()
const { etherpadApiUrl } = useEtherpadApi() const { etherFetch } = useEtherpadApi()
const { poskrolaj } = useUi() const { poskrolaj } = useUi()
const route = useRoute() const route = useRoute()
@ -13,8 +13,10 @@ revisionId.value = route.params.guid ? route.params.guid : getRandomUUID()
// Ustvari nov, prazen pad // Ustvari nov, prazen pad
// @TODO parameter za seranje linka? // @TODO parameter za seranje linka?
const padId = revisionId.value const resp = await etherFetch('/createPad', {
const resp = await $fetch(`${etherpadApiUrl}/createPad?padID=${padId}`) padID: revisionId.value,
text: ''
})
const onZapri = () => { navigateTo('/manifest#skrol') } const onZapri = () => { navigateTo('/manifest#skrol') }