|
@@ -1,7 +1,6 @@
|
1
|
1
|
import axios from 'axios';
|
2
|
2
|
import { BASE_URL } from "./config.js";
|
3
|
3
|
|
4
|
|
-
|
5
|
4
|
const get = async (
|
6
|
5
|
endpoint,
|
7
|
6
|
jwt_token = null,
|
|
@@ -12,11 +11,14 @@ const get = async (
|
12
|
11
|
opt["Authorization"] = jwt_token
|
13
|
12
|
}
|
14
|
13
|
|
15
|
|
- console.log("HELLO 1");
|
16
|
|
- const response = await axios.get(BASE_URL + endpoint, { headers: opt })
|
17
|
|
- console.log(response.data);
|
18
|
|
- return response.data
|
19
|
|
-
|
|
14
|
+ try {
|
|
15
|
+ console.log("HELLO 1");
|
|
16
|
+ const response = await axios.get(BASE_URL + endpoint, { headers: opt })
|
|
17
|
+ console.log(response.data);
|
|
18
|
+ return response.data
|
|
19
|
+ } catch (err) {
|
|
20
|
+ console.error(`An error occurred while trying to fetch` + endpoint + `:` + err);
|
|
21
|
+ }
|
20
|
22
|
}
|
21
|
23
|
|
22
|
24
|
export default get;
|