0
0
mirror of https://github.com/Doodle3D/Doodle3D-API synced 2024-06-01 21:44:31 +02:00
Doodle3D-API/src/utils.js

13 lines
290 B
JavaScript
Raw Permalink Normal View History

2016-04-21 15:44:20 +02:00
export function sleep(time) {
2016-04-21 15:52:23 +02:00
return new Promise((resolve, reject) => {
setTimeout(resolve, time);
});
}
2017-11-30 17:23:13 +01:00
export function parseFetch(response) {
return response.json().then(({ status, data, msg }) => {
if (!status === 'success') throw new Error(msg);
return data;
});
}