Skip to content

Commit 4d209d7

Browse files
committed
Fix API base URL
1 parent eef1144 commit 4d209d7

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

oclif.manifest.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/base.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,23 @@ export default abstract class extends Command {
1717
this.configuration = explorerSync.search()
1818
this.apiKey = this.configuration?.config.apiKey
1919

20-
// Configure API.
20+
// Configure API calls.
2121
axios.defaults.baseURL =
22-
this.configuration?.config.baseURL ||
23-
'https://voxable.design/api/v1/'
24-
axios.defaults.headers.common = {
25-
Authorization: `Bearer ${this.apiKey}`,
26-
'User-Agent': '@voxable/cli',
22+
this.configuration?.config.baseURL || 'https://api.voxable.design/v1/'
23+
axios.defaults.headers.common.Authorization = `Bearer ${this.apiKey}`
24+
axios.defaults.headers.common['User-Agent'] = '@voxable/cli'
25+
26+
// Debug requests and responses if DEBUG=true
27+
if (process.env.DEBUG) {
28+
axios.interceptors.request.use(req => {
29+
console.log(req)
30+
return req
31+
}, error => Promise.reject(error))
32+
33+
axios.interceptors.response.use(res => {
34+
console.log(res)
35+
return res
36+
}, error => Promise.reject(error))
2737
}
2838

2939
this.fetch = axios

0 commit comments

Comments
 (0)