Add a new page to list repos and submissions

This commit is contained in:
nemunaire 2022-09-09 20:14:38 +02:00
commit 6323d96b60
12 changed files with 167 additions and 33 deletions

View file

@ -7,8 +7,11 @@ export async function getPromos() {
}
}
export async function getUsers() {
const res = await fetch('api/users', {headers: {'Accept': 'application/json'}})
export async function getUsers(promo, group) {
let url = '/api/users?';
if (promo) url += "promo=" + encodeURIComponent(promo) + "&";
if (group) url += "group=" + encodeURIComponent(group) + "&";
const res = await fetch(url, {headers: {'Accept': 'application/json'}})
if (res.status == 200) {
return await res.json();
} else {

View file

@ -91,8 +91,8 @@ export class Work {
}
}
async getSubmission() {
const res = await fetch(`api/works/${this.id}/submission`, {
async getSubmission(uid) {
const res = await fetch(uid?`api/users/${uid}/works/${this.id}/submission`:`api/works/${this.id}/submission`, {
headers: {'Accept': 'application/json'}
});
if (res.status == 200) {