1import axios from "axios";
2
3let one =
4 "https://api.storyblok.com/v1/cdn/stories/health?version=published&token=wANpEQEsMYGOwLxwXQ76Ggtt";
5let two =
6 "https://api.storyblok.com/v1/cdn/datasources/?token=wANpEQEsMYGOwLxwXQ76Ggtt";
7let three =
8 "https://api.storyblok.com/v1/cdn/stories/vue?version=published&token=wANpEQEsMYGOwLxwXQ76Ggtt";
9
10const requestOne = axios.get(one);
11const requestTwo = axios.get(two);
12const requestThree = axios.get(three);
13
14axios
15 .all([requestOne, requestTwo, requestThree])
16 .then(
17 axios.spread((...responses) => {
18 const responseOne = responses[0];
19 const responseTwo = responses[1];
20 const responesThree = responses[2];
21
22 // use/access the results
23 console.log(responseOne, responseTwo, responesThree);
24 })
25 )
26 .catch(errors => {
27 // react on errors.
28 console.error(errors);
29 });
1// set requests
2const reqOne = axios.get(endpoint);
3const reqTwo = axios.get(endpoint);
4
5axios.all([reqOne, reqTwo]).then(axios.spread((...responses) => {
6 const responseOne = responses[0]
7 const responseTwo = responses[1]
8})).catch(errors => {
9 // react on errors.
10})