RSE/frontend/plugins/getProgress.ts

20 lines
568 B
TypeScript

export default function getProgress(){
const progress = ref(null as Progress | null);
fetch('https://proxy.rbwr.dk/progress', {
method: 'GET',
headers: {'Content-Type': 'application/json'}
})
.then(response => response.json())
.then((data: Progress) => {
if (data && data.percentageOfIpv4Scanned) {
progress.value = data;
} else {
console.error("Invalid data received from API");
console.error(data);
}
});
return progress;
}