mirror of
https://git.netzspielplatz.de/docker-multiarch/openwrt-firmware-selector.git
synced 2025-11-08 19:09:24 +00:00
ESLint is used with the standard react plugin. It detects all kinds of issues ranging from misspells, indentation, variable-naming, etc. A pre-commit hook is added to git. Prior commiting, ESlint will run to validate that everything is OK and the user will have the option to fix it. Signed-off-by: Sudhanshu Gautam <me@sudhanshug.com>
48 lines
1.2 KiB
JavaScript
48 lines
1.2 KiB
JavaScript
import axios from 'axios';
|
|
|
|
const base = 'https://cors-anywhere.herokuapp.com/https://mwarning.de/misc/json/bin';
|
|
|
|
class DataService {
|
|
|
|
getDevicesData = axios.get(
|
|
`${base}/overview.json`)
|
|
.then(res => res.data);
|
|
|
|
getDeviceData = (device_id) => axios.get(
|
|
base + '/targets/' + device_id)
|
|
.then(res => res.data);
|
|
|
|
getDistributions = axios.get(
|
|
'https://chef.libremesh.org/api/distributions')
|
|
.then(res => res.data);
|
|
|
|
buildImage = (board, packages, target, version) => {
|
|
return axios.post('https://chef.libremesh.org/api/build-request', {
|
|
board,
|
|
defaults: '',
|
|
distro: 'openwrt',
|
|
packages,
|
|
target,
|
|
version,
|
|
});
|
|
};
|
|
|
|
buildStatusCheck = async (request_hash) => {
|
|
let response = {
|
|
isBuilt: false,
|
|
};
|
|
await axios.get('https://chef.libremesh.org/api/build-request/' + request_hash).then((res) => {
|
|
response.isBuilt = res.status === 202 && res.data.files !== undefined;
|
|
response.status = res.status;
|
|
if (response.isBuilt) {
|
|
response = {...response, data: res.data};
|
|
}
|
|
});
|
|
return response;
|
|
};
|
|
|
|
getFiles = (files_url) => axios.get('https://chef.libremesh.org' + files_url).then(res => res.data);
|
|
|
|
}
|
|
|
|
export default DataService;
|