Skip to content

Commit 90b5212

Browse files
feat: update auth class
1 parent 0835c0a commit 90b5212

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/utils/auth.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ class Auth {
1313
this.password = config.password;
1414
this.grant_type = config.grant_type;
1515
this.client_id = config.client_id;
16-
this.log = config.log;
1716
this.response_type = config.response_type;
1817
this.request_timeout = config.request_timeout;
1918
}
@@ -37,7 +36,20 @@ class Auth {
3736
)
3837
};
3938

40-
const { data } = await axios(config);
39+
const { data } = await axios(config)
40+
.then((res) => {
41+
// Send log message when endpoint request is successful
42+
console.warn(`[${config.method.toUpperCase()}] ${config.url} (${res.statusText})`);
43+
44+
return res;
45+
})
46+
.catch((err) => {
47+
// Send log message when endpoint request is unsuccessful
48+
console.error(`[${config.method.toUpperCase()}] ${config.url} - ${err.message}`);
49+
50+
return err;
51+
});
52+
4153
return data;
4254
}
4355
}

0 commit comments

Comments
 (0)