-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ : add axios interceptors to handle responses
- Loading branch information
1 parent
f5c81dc
commit 2ff794f
Showing
11 changed files
with
31 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
import axios from 'axios'; | ||
|
||
export const getBuildInfo = async () => { | ||
const resp = await axios.get('/build-info'); | ||
return resp.data; | ||
}; | ||
export const getBuildInfo = async () => axios.get('/build-info'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
import axios from 'axios'; | ||
|
||
export const getSummary = async () => { | ||
const resp = await axios.get('/api/dashboard/summary'); | ||
return resp.data; | ||
}; | ||
export const getSummary = async () => axios.get('/api/dashboard/summary'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,11 @@ | ||
import axios from 'axios'; | ||
|
||
export const getModules = async () => { | ||
const resp = await axios.get('/api/modules'); | ||
return resp.data; | ||
}; | ||
export const getModules = async () => axios.get('/api/modules'); | ||
|
||
export const getModule = async (moduleId) => { | ||
const resp = await axios.get(`/api/modules/${moduleId}`); | ||
return resp.data; | ||
}; | ||
export const getModule = async (moduleId) => axios.get(`/api/modules/${moduleId}`); | ||
|
||
export const getModuleReadme = async (moduleId) => { | ||
const resp = await axios.get(`/api/modules/${moduleId}/readme`); | ||
return resp.data; | ||
}; | ||
export const getModuleReadme = async (moduleId) => axios.get(`/api/modules/${moduleId}/readme`); | ||
|
||
export const updateModule = async (module) => axios.put(`/api/modules/${module.id}`, module); | ||
|
||
export const createModule = async (module) => { | ||
const resp = await axios.post('/api/modules', module); | ||
return resp.data; | ||
}; | ||
export const createModule = async (module) => axios.post('/api/modules', module); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,7 @@ | ||
import axios from 'axios'; | ||
|
||
export const getRegistriesRepositories = async (registry) => { | ||
const resp = await axios.get(`/api/registries/${registry}/repositories`); | ||
return resp.data; | ||
}; | ||
export const getRegistriesRepositories = async (registry) => axios.get(`/api/registries/${registry}/repositories`); | ||
|
||
export const importRegistryRepository = async (registry, id) => { | ||
const resp = await axios.post(`/api/registries/${registry}/repositories/${id}/import`); | ||
return resp.data; | ||
}; | ||
export const importRegistryRepository = async (registry, id) => axios.post( | ||
`/api/registries/${registry}/repositories/${id}/import`, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,5 @@ | ||
import axios from 'axios'; | ||
|
||
export const getSettings = async () => { | ||
const resp = await axios.get('/api/settings'); | ||
return resp.data; | ||
}; | ||
export const getSettings = async () => axios.get('/api/settings'); | ||
|
||
export const saveSettings = async (settings) => axios.put('/api/settings', settings); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
import axios from 'axios'; | ||
|
||
export const createStack = async (stack) => { | ||
const resp = await axios.post('/api/stacks', stack); | ||
return resp.data; | ||
}; | ||
export const createStack = async (stack) => axios.post('/api/stacks', stack); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
import axios from 'axios'; | ||
|
||
export const getTeams = async () => { | ||
const resp = await axios.get('/api/teams'); | ||
return resp.data; | ||
}; | ||
export const getTeams = async () => axios.get('/api/teams'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,5 @@ | ||
import axios from 'axios'; | ||
|
||
export const getUsers = async () => { | ||
const resp = await axios.get('/api/users'); | ||
return resp.data; | ||
}; | ||
export const getUsers = async () => axios.get('/api/users'); | ||
|
||
export const updateUser = async (user) => axios.put(`/api/users/${user.id}`, user); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import axios from 'axios'; | ||
|
||
export default { | ||
init: () => { | ||
axios.interceptors.response.use( | ||
(response) => response.data, | ||
(error) => Promise.reject(error.response.data), | ||
); | ||
}, | ||
}; |