From 333560ff415f64089100de3979fdea5f38486750 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jurij=20Podgor=C5=A1ek?= Date: Sun, 12 Nov 2023 23:46:57 +0100 Subject: [PATCH] API klic za ustvarit nov pad, manjsi popravki (trailing /) --- nuxt/.env.dist | 3 ++- nuxt/components/DodajPojem.vue | 9 +++++++-- nuxt/components/EtherpadTextarea.vue | 2 +- nuxt/components/PojemForm.vue | 4 ---- nuxt/nuxt.config.js | 1 + web/modules/custom/etherpad_api/src/Client.php | 4 ++-- 6 files changed, 13 insertions(+), 10 deletions(-) diff --git a/nuxt/.env.dist b/nuxt/.env.dist index fb8ea11..c505f6f 100644 --- a/nuxt/.env.dist +++ b/nuxt/.env.dist @@ -1,5 +1,6 @@ BASE_URL="https://yufu-manifest.ddev.site" JSONAPI_PATH="/jsonapi" FILE_PATH="/sites/default/files" -ETHERPAD_URL="https://pisi.kompot.si/" +ETHERPAD_URL="https://pisi.kompot.si" +ETHERPAD_API_URL="https://yufu-manifest.ddev.site/etherpad-api" ETHERPAD_PREFIX="yufu-" diff --git a/nuxt/components/DodajPojem.vue b/nuxt/components/DodajPojem.vue index 134353f..7f555f1 100644 --- a/nuxt/components/DodajPojem.vue +++ b/nuxt/components/DodajPojem.vue @@ -1,12 +1,17 @@ diff --git a/nuxt/components/EtherpadTextarea.vue b/nuxt/components/EtherpadTextarea.vue index 5e54562..c19fcf3 100644 --- a/nuxt/components/EtherpadTextarea.vue +++ b/nuxt/components/EtherpadTextarea.vue @@ -14,7 +14,7 @@ const embed = ref(null) onMounted(() => { // Ce ni revisionId propertyja, se random generira. const uuid = props.revisionId ? props.revisionId : crypto.randomUUID() - const padUrl = `${etherpadUrl}p/${etherpadPrefix}${uuid}?showChat=false&showLineNumbers=false&toc=false` + const padUrl = `${etherpadUrl}/p/${etherpadPrefix}${uuid}?showChat=false&showLineNumbers=false&toc=false` embed.value.src = padUrl }) diff --git a/nuxt/components/PojemForm.vue b/nuxt/components/PojemForm.vue index 657a703..6e8c084 100644 --- a/nuxt/components/PojemForm.vue +++ b/nuxt/components/PojemForm.vue @@ -26,10 +26,6 @@ const oddajPredlog = data => { } const etherNalozen = ev => { - // @TODO DRY - const padUrl = `${etherpadUrl}p/${etherpadPrefix}${props.revisionId}?showChat=false&showLineNumbers=false&toc=false` - // Izprazni pad! - console.log('etherpad nalozen!') window.location.hash = props.revisionId } diff --git a/nuxt/nuxt.config.js b/nuxt/nuxt.config.js index 2271331..ee9793b 100644 --- a/nuxt/nuxt.config.js +++ b/nuxt/nuxt.config.js @@ -36,6 +36,7 @@ export default defineNuxtConfig({ baseUrl: process.env.BASE_URL, jsonapiPath: process.env.JSONAPI_PATH, etherpadUrl: process.env.ETHERPAD_URL, + etherpadApiUrl: process.env.ETHERPAD_API_URL, etherpadPrefix: process.env.ETHERPAD_PREFIX } } diff --git a/web/modules/custom/etherpad_api/src/Client.php b/web/modules/custom/etherpad_api/src/Client.php index 8fc4c4a..1f54f02 100644 --- a/web/modules/custom/etherpad_api/src/Client.php +++ b/web/modules/custom/etherpad_api/src/Client.php @@ -46,14 +46,14 @@ class Client { } public function checkToken() { - return $this->request('get', '/checkToken'); + return $this->request('get', 'checkToken'); } /** * Method description. */ public function request($method, $url) { - $uri = "{$this->baseUrl}/" . self::API_VERSION . $url; + $uri = "{$this->baseUrl}/" . self::API_VERSION . '/' . $url; if (str_contains($uri, '?')) { $uri .= "&apikey={$this->apiKey}";