0
0
mirror of https://github.com/Doodle3D/Doodle3D-API synced 2024-06-17 02:11:22 +02:00
Doodle3D-API/src/utils.js
2017-11-30 17:23:13 +01:00

13 lines
290 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;
});
}