mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-01-22 15:18:43 +00:00
Fix web api client (#3779)
This commit is contained in:
parent
7cae6e58f8
commit
9bc15a5f3b
1 changed files with 3 additions and 3 deletions
|
@ -40,7 +40,7 @@ export default class ApiClient {
|
||||||
this.csrf = csrf;
|
this.csrf = csrf;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _request(method: string, path: string, data: unknown): Promise<unknown> {
|
private async _request(method: string, path: string, data?: unknown): Promise<unknown> {
|
||||||
const res = await fetch(`${this.server}${path}`, {
|
const res = await fetch(`${this.server}${path}`, {
|
||||||
method,
|
method,
|
||||||
headers: {
|
headers: {
|
||||||
|
@ -71,7 +71,7 @@ export default class ApiClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
_get(path: string) {
|
_get(path: string) {
|
||||||
return this._request('GET', path, null);
|
return this._request('GET', path);
|
||||||
}
|
}
|
||||||
|
|
||||||
_post(path: string, data?: unknown) {
|
_post(path: string, data?: unknown) {
|
||||||
|
@ -83,7 +83,7 @@ export default class ApiClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
_delete(path: string) {
|
_delete(path: string) {
|
||||||
return this._request('DELETE', path, null);
|
return this._request('DELETE', path);
|
||||||
}
|
}
|
||||||
|
|
||||||
_subscribe<T>(path: string, callback: (data: T) => void, opts = { reconnect: true }) {
|
_subscribe<T>(path: string, callback: (data: T) => void, opts = { reconnect: true }) {
|
||||||
|
|
Loading…
Reference in a new issue