1
This commit is contained in:
11
frontend/js/api.js
Normal file → Executable file
11
frontend/js/api.js
Normal file → Executable file
@@ -1,6 +1,7 @@
|
||||
// Linux BenchTools - API Client
|
||||
|
||||
const API_BASE_URL = window.location.protocol + '//' + window.location.hostname + ':8007/api';
|
||||
const API_BASE_URL = (window.BenchConfig && window.BenchConfig.backendApiUrl)
|
||||
|| `${window.location.protocol}//${window.location.hostname}:8007/api`;
|
||||
|
||||
class BenchAPI {
|
||||
constructor(baseURL = API_BASE_URL) {
|
||||
@@ -143,6 +144,14 @@ class BenchAPI {
|
||||
return this.get(`/benchmarks/${benchmarkId}`);
|
||||
}
|
||||
|
||||
// Update benchmark fields
|
||||
async updateBenchmark(benchmarkId, data) {
|
||||
return this.request(`/benchmarks/${benchmarkId}`, {
|
||||
method: 'PATCH',
|
||||
body: JSON.stringify(data)
|
||||
});
|
||||
}
|
||||
|
||||
// Get all benchmarks
|
||||
async getAllBenchmarks(params = {}) {
|
||||
return this.get('/benchmarks', params);
|
||||
|
||||
Reference in New Issue
Block a user