RSE/frontend/plugins/getProgress.ts

17 lines
482 B
TypeScript

export default function getProgress(){
const progress = ref(null as Progress | null);
fetch('http://localhost:5224/progress')
.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;
}