Use repositories API allowed for everyone
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
60540a1631
commit
a5105979cc
@ -15,7 +15,7 @@ export class WorkRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async delete() {
|
async delete() {
|
||||||
const res = await fetch(`api/repositories/${this.id}`, {
|
const res = await fetch(this.id_work?`api/works/${this.id_work}/repositories/${this.id}`:`api/repositories/${this.id}`, {
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
headers: {'Accept': 'application/json'}
|
headers: {'Accept': 'application/json'}
|
||||||
});
|
});
|
||||||
@ -27,7 +27,7 @@ export class WorkRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getBuildState() {
|
async getBuildState() {
|
||||||
const res = await fetch(`api/repositories/${this.id}/state`, {
|
const res = await fetch(this.id_work?`api/works/${this.id_work}/repositories/${this.id}/state`:`api/repositories/${this.id}/state`, {
|
||||||
headers: {'Accept': 'application/json'}
|
headers: {'Accept': 'application/json'}
|
||||||
});
|
});
|
||||||
if (res.status == 200) {
|
if (res.status == 200) {
|
||||||
@ -38,7 +38,7 @@ export class WorkRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getBuildLogs() {
|
async getBuildLogs() {
|
||||||
const res = await fetch(`api/repositories/${this.id}/state-logs`, {
|
const res = await fetch(this.id_work?`api/works/${this.id_work}/repositories/${this.id}/state-logs`:`api/repositories/${this.id}/state-logs`, {
|
||||||
headers: {'Accept': 'application/json'}
|
headers: {'Accept': 'application/json'}
|
||||||
});
|
});
|
||||||
if (res.status == 200) {
|
if (res.status == 200) {
|
||||||
@ -49,7 +49,7 @@ export class WorkRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async retrieveWork() {
|
async retrieveWork() {
|
||||||
const res = await fetch(`api/repositories/${this.id}/trigger`, {
|
const res = await fetch(this.id_work?`api/works/${this.id_work}/repositories/${this.id}/trigger`:`api/repositories/${this.id}/trigger`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {'Accept': 'application/json'}
|
headers: {'Accept': 'application/json'}
|
||||||
});
|
});
|
||||||
@ -63,7 +63,13 @@ export class WorkRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async save() {
|
async save() {
|
||||||
const res = await fetch(this.id?`api/repositories/${this.id}`:'api/repositories', {
|
let url = this.id?`repositories/${this.id}`:'repositories';
|
||||||
|
|
||||||
|
if (this.id_work) {
|
||||||
|
url = `works/${this.id_work}/` + url;
|
||||||
|
}
|
||||||
|
|
||||||
|
const res = await fetch("api/"+url, {
|
||||||
method: this.id?'PUT':'POST',
|
method: this.id?'PUT':'POST',
|
||||||
headers: {'Accept': 'application/json'},
|
headers: {'Accept': 'application/json'},
|
||||||
body: JSON.stringify(this),
|
body: JSON.stringify(this),
|
||||||
|
Reference in New Issue
Block a user