This repository has been archived on 2023-08-24. You can view files and clone it, but cannot push or open issues or pull requests.
OwlBoard/src/services/issue.services.js
Fred Boniface 205c6b5d6b Backend: Implement basic issue API
Signed-off-by: Fred Boniface <fred@fjla.uk>
2023-01-30 23:47:14 +00:00

28 lines
607 B
JavaScript

const axios = require('axios')
const clean = require('../utils/sanitizer.utils')
async function processor(data) {
let out = {}
out.title = await cleanData(data.title)
out.body = await cleanData(data.body)
sendToGitea(out);
}
async function cleanData(data) {
return clean.cleanApiEndpointTxt(data)
}
async function sendToGitea(body) {
let key = process.env.OWL_GIT_ISSUEBOT
let url = process.env.OWL_GIT_APIENDPOINT
let opts = {
headers: {
Authorization: key
}
}
await axios.post(url, body, opts)
}
module.exports = {
processor
}