mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2025-05-01 21:50:29 +03:00
Show toast on failed request
This commit is contained in:
parent
9258fada47
commit
828bb40084
11 changed files with 230 additions and 32 deletions
client/src/api
|
@ -6,12 +6,16 @@ export default class Api {
|
|||
baseUrl = 'control';
|
||||
|
||||
async makeRequest(path, method = 'POST', config) {
|
||||
const response = await axios({
|
||||
url: `${this.baseUrl}/${path}`,
|
||||
method,
|
||||
...config,
|
||||
});
|
||||
return response.data;
|
||||
try {
|
||||
const response = await axios({
|
||||
url: `${this.baseUrl}/${path}`,
|
||||
method,
|
||||
...config,
|
||||
});
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
throw new Error(`${this.baseUrl}/${path} | ${error.response.data} | ${error.response.status}`);
|
||||
}
|
||||
}
|
||||
|
||||
// Global methods
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue