-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.js
49 lines (38 loc) · 1.21 KB
/
utils.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
const { default: axios } = require('axios');
const displayImage = require('display-image');
const { stARTupSkeleton } = require('.');
const { anonymousGalleryPrompt } = require('./prompts');
const URL = 'https://futuramaapi.herokuapp.com/api/quotes';
const getAllImages = async () => {
const allImages = await axios.get(`${URL}/2`);
allImages.data.forEach((element) => {
displayImage
.fromURL(element.image)
.then((image) => console.log(image, 'Press arrows keys to continue'));
});
};
const getRandomImage = async () => {
const randomImage = await axios.get(`${URL}/1`);
displayImage
.fromURL(randomImage.data[0].image)
.then((image) => console.log(image, 'Press arrows keys to continue'));
console.log(`
${randomImage.data[0].character}
${randomImage.data[0].quote}`);
};
const getUserDrawings = async () => {
const allDrawings = await axios.get();
allDrawings.data.forEach((element) => {
displayImage
.fromURL(element.image)
.then((image) => console.log(image, 'Press arrows keys to continue'));
});
};
const deleteADrawing = async () => {
const deletedDrawing = await axios.delete()
}
module.exports = {
getAllImages,
getRandomImage,
getUserDrawings,
};