From eac4016422107ae0f9eefa08fd6193e91aeda028 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Wed, 8 Feb 2023 13:25:49 +0000 Subject: [PATCH] FullStack: - Fix Issue API Problems - Bump both backend & frontend version. Signed-off-by: Fred Boniface --- src/configs/version.configs.js | 2 +- src/services/issue.services.js | 4 ++++ static/index.html | 2 +- static/js/issue.js | 2 +- static/sw.js | 2 +- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/configs/version.configs.js b/src/configs/version.configs.js index 036abdb..2018445 100644 --- a/src/configs/version.configs.js +++ b/src/configs/version.configs.js @@ -1,6 +1,6 @@ const version = { api: ["/api/v1/",], - app: "0.0.1" + app: "0.0.2" }; module.exports = version; \ No newline at end of file diff --git a/src/services/issue.services.js b/src/services/issue.services.js index a3c16de..4bea3fb 100644 --- a/src/services/issue.services.js +++ b/src/services/issue.services.js @@ -1,6 +1,8 @@ const axios = require('axios') +const log = require('../utils/log.utils') async function processor(data) { + log.out(`issueService.processor: Issue received`) let out = {} out.title = data.subject.replace(/<[^>]+>|[\*\$]/g, ''); out.body = data.msg.replace(/<[^>]+>|[\*\$]/g, '') @@ -18,8 +20,10 @@ async function sendToGitea(body) { var res = await axios.post(url, body, opts) // Need to read the output from the POST and pass the result upwards to the client. if (res.status == 201) { + log.out("issueService.sendToGitea: Issue sent to Gitea") return {status: res.status,message:"issue created"} } else { + log.out("issueService.sendToGitea: Failed to send issue to Gitea") return {status: res.status,message:"issue not created"} } } diff --git a/static/index.html b/static/index.html index abc3b7f..f41e44a 100644 --- a/static/index.html +++ b/static/index.html @@ -64,7 +64,7 @@ diff --git a/static/js/issue.js b/static/js/issue.js index 64db3a5..01d3940 100644 --- a/static/js/issue.js +++ b/static/js/issue.js @@ -72,7 +72,7 @@ async function send() { redirect: 'follow', body: payload } - var res = await fetch("/api/v1/issue", opt) + var res = await fetch(`${window.location.origin}/api/v1/issue`, opt) if (res.status == 200) { setLoadingDesc("Success") vibe("ok") diff --git a/static/sw.js b/static/sw.js index ee57f4b..fb47816 100644 --- a/static/sw.js +++ b/static/sw.js @@ -1,6 +1,6 @@ /* Service Worker */ -const appVersion = "0.0.2" +const appVersion = "0.0.3" const cacheName = `owlboard-${appVersion}` const cacheIDs = [cacheName] const cacheFiles = [