Add create jira bug

This commit is contained in:
Amaryllis 2023-12-18 14:04:26 +01:00
parent 6c8cf194a7
commit 1a7822ea69
13 changed files with 418 additions and 97 deletions

View file

@ -1,5 +1,6 @@
import * as axios from 'axios';
import config from '../config';
import { getJiraToken } from '../utils/jira';
export default async function search(version?: string): Promise<any[]> {
const params = {
@ -17,14 +18,19 @@ export default async function search(version?: string): Promise<any[]> {
do {
// @ts-expect-error
const httpParams = Object.keys(params).map(key => `${key}=${params[key]}`).join('&');
const httpParams = Object.keys(params).map((key: string) => `${key}=${params[key]}`).join('&');
const url = `${config.jira.baseUrl}/search?${httpParams}`;
const serverResponse = await new axios.Axios({}).get(url);
jsonResponse = JSON.parse(serverResponse.data);
const serverResponse = await new axios.Axios({}).get(url, { headers: { "Authorization": getJiraToken() } }).catch((e) => console.error(e))
if (serverResponse) {
jsonResponse = JSON.parse(serverResponse.data);
issues.push(...jsonResponse!.issues);
params.startAt += 100;
}
else {
return []
}
issues.push(...jsonResponse!.issues);
params.startAt += 100;
} while (jsonResponse!.issues.length > 99 && jsonResponse!.total > 100);
return issues;

View file

@ -12,7 +12,7 @@ interface Message {
export const messages: Record<string, Message> = {};
let avatarUrl = "";
const load = async () => {
export const loadMessages = async () => {
const messagesList = require('../messages.json')["faq"];
messagesList.forEach((msg: any) => {
messages[msg["title"]] = msg
@ -26,9 +26,6 @@ const load = async () => {
console.log(avatarUrl);
}
load();
export const get = (name: string) => messages[name];
export const getList = () => Object.keys(messages).map(msg => ({ name: messages[msg].names[0], value: messages[msg].description }));