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() {
|
||||
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',
|
||||
headers: {'Accept': 'application/json'}
|
||||
});
|
||||
@ -27,7 +27,7 @@ export class WorkRepository {
|
||||
}
|
||||
|
||||
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'}
|
||||
});
|
||||
if (res.status == 200) {
|
||||
@ -38,7 +38,7 @@ export class WorkRepository {
|
||||
}
|
||||
|
||||
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'}
|
||||
});
|
||||
if (res.status == 200) {
|
||||
@ -49,7 +49,7 @@ export class WorkRepository {
|
||||
}
|
||||
|
||||
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',
|
||||
headers: {'Accept': 'application/json'}
|
||||
});
|
||||
@ -63,7 +63,13 @@ export class WorkRepository {
|
||||
}
|
||||
|
||||
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',
|
||||
headers: {'Accept': 'application/json'},
|
||||
body: JSON.stringify(this),
|
||||
|
Reference in New Issue
Block a user