fix: localize API error messages
Build and publish Docker images / Build and publish images (push) Successful in 2m35s
Build and publish Docker images / Build and publish images (push) Successful in 2m35s
This commit is contained in:
@@ -1,6 +1,19 @@
|
||||
import axios from 'axios';
|
||||
import { parseAPIErrorResponse } from 'dashboard/store/utils/api';
|
||||
|
||||
const { apiHost = '' } = window.chatwootConfig || {};
|
||||
const wootAPI = axios.create({ baseURL: `${apiHost}/`, withCredentials: true });
|
||||
|
||||
if (wootAPI?.interceptors?.response) {
|
||||
wootAPI.interceptors.response.use(
|
||||
response => response,
|
||||
error => {
|
||||
if (error && typeof error === 'object') {
|
||||
error.message = parseAPIErrorResponse(error);
|
||||
}
|
||||
return Promise.reject(error);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export default wootAPI;
|
||||
|
||||
Reference in New Issue
Block a user