-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.mjs
25 lines (22 loc) · 871 Bytes
/
example.mjs
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
// ** have saveData be triggered on a button click, as if they're clicking to download whatever data
const saveData = async () => {
// you can paste your graph_url output, I think this only works if the ending url has png or jpg
const url = graph_url;
// customize the path you want the image to save to
const savePath = '/Users/kenzie/Documents/pokeStats.png';
let sendImgData = {
url,
savePath
};
// make sure to change the port to whatever port you're running this service on
const path = 'http://localhost:8095/savePokeChart';
await fetch(path, {
method: 'POST',
body: JSON.stringify(sendImgData),
headers: {
Accept: 'application/json',
'Content-Type': 'application/json'
}
});
// you shouldn't have to return anything
}