UI: fix api paths for target charging; better error handling (#6116)
This commit is contained in:
parent
4ff0b9a5fd
commit
98351bdde1
2 changed files with 9 additions and 5 deletions
|
|
@ -15,8 +15,11 @@ const api = axios.create({
|
|||
api.interceptors.response.use(
|
||||
(response) => response,
|
||||
(error) => {
|
||||
const url = error.config.baseURL + error.config.url;
|
||||
const message = `${error.message}: API request failed ${url}`;
|
||||
let message = error.message;
|
||||
if (error.config) {
|
||||
const url = error.config.baseURL + error.config.url;
|
||||
message += `: API request failed ${url}`;
|
||||
}
|
||||
window.app.error({ message });
|
||||
return Promise.reject(error);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -242,16 +242,17 @@ export default {
|
|||
if (
|
||||
this.isModalVisible &&
|
||||
!this.timeInThePast &&
|
||||
(this.targetEnergy || this.targetSoc)
|
||||
(this.targetEnergy || this.targetSoc) &&
|
||||
!isNaN(this.selectedTargetTime)
|
||||
) {
|
||||
try {
|
||||
const opts = {
|
||||
params: { targetTime: this.selectedTargetTime },
|
||||
};
|
||||
this.plan = (
|
||||
await api.get(`/loadpoints/${this.id}/target/plan`, opts)
|
||||
await api.get(`loadpoints/${this.id}/target/plan`, opts)
|
||||
).data.result;
|
||||
this.tariff = (await api.get(`/tariff/planner`)).data.result;
|
||||
this.tariff = (await api.get(`tariff/planner`)).data.result;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue