qa: Back to the same situation
This commit is contained in:
parent
00f84e43ca
commit
1aa82bb2ef
27 changed files with 1336 additions and 22 deletions
61
qa/ui/src/lib/todo.js
Normal file
61
qa/ui/src/lib/todo.js
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
import { QAQuery } from './qa';
|
||||
|
||||
export class QATodo {
|
||||
constructor(res) {
|
||||
if (res) {
|
||||
this.update(res);
|
||||
}
|
||||
}
|
||||
|
||||
update({ id, id_team, id_exercice }) {
|
||||
this.id = id;
|
||||
this.id_team = id_team;
|
||||
this.id_exercice = id_exercice;
|
||||
}
|
||||
}
|
||||
|
||||
export async function getQATodo() {
|
||||
const res = await fetch(`api/qa_work.json`, {headers: {'Accept': 'application/json'}})
|
||||
if (res.status == 200) {
|
||||
return (await res.json()).map((t) => new QATodo(t));
|
||||
} else {
|
||||
throw new Error((await res.json()).errmsg);
|
||||
}
|
||||
}
|
||||
|
||||
export async function getQAWork() {
|
||||
const res = await fetch(`api/qa_mywork.json`, {headers: {'Accept': 'application/json'}})
|
||||
if (res.status == 200) {
|
||||
const data = await res.json()
|
||||
if (data) {
|
||||
return data.map((t) => new QAQuery(t));
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
} else {
|
||||
throw new Error((await res.json()).errmsg);
|
||||
}
|
||||
}
|
||||
|
||||
export async function getQAView() {
|
||||
const res = await fetch(`api/qa_myexercices.json`, {headers: {'Accept': 'application/json'}})
|
||||
if (res.status == 200) {
|
||||
const data = await res.json()
|
||||
if (data) {
|
||||
return data.map((t) => new QATodo(t));
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
} else {
|
||||
throw new Error((await res.json()).errmsg);
|
||||
}
|
||||
}
|
||||
|
||||
export async function getExerciceTested() {
|
||||
const res = await fetch(`api/qa_exercices.json`, {headers: {'Accept': 'application/json'}})
|
||||
if (res.status == 200) {
|
||||
return await res.json();
|
||||
} else {
|
||||
throw new Error((await res.json()).errmsg);
|
||||
}
|
||||
}
|
||||
Reference in a new issue