mirror of
https://github.com/Doodle3D/Doodle3D-API
synced 2024-06-16 09:51:22 +02:00
13 lines
289 B
JavaScript
13 lines
289 B
JavaScript
export function sleep(time) {
|
|
return new Promise((resolve, reject) => {
|
|
setTimeout(resolve, time);
|
|
});
|
|
}
|
|
|
|
export function parseFetch(response) {
|
|
return response.json().then(({ status, data, msg }) => {
|
|
if (status !== 'success') throw new Error(msg);
|
|
return data;
|
|
});
|
|
}
|