|
|
@ -26,30 +26,30 @@ const axiosService = axios.create({
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
// const alertError = (config: AxiosRequestConfig, request: any, response: AxiosResponse, error: Error) => {
|
|
|
|
// const alertError = (config: AxiosRequestConfig, request: any, response: AxiosResponse, error: Error) => {
|
|
|
|
const alertError = (config, request, response, error) => {
|
|
|
|
const alertError = (config, request, response, error) => {
|
|
|
|
if (error.isAxiosError) {
|
|
|
|
if (response && response.data) {
|
|
|
|
let errMsg = `시스템 에러~~~~~~~~~~~~`;
|
|
|
|
const errCode = response.data.code || response.data.status;
|
|
|
|
if (error.code === 'ECONNABORTED') errMsg = 'Server time out';
|
|
|
|
const errMsg = response.data.code != '' && response.data.code != null ? response.data.message : response.data.error;
|
|
|
|
|
|
|
|
console.error(`${errCode}: ${errMsg}`);
|
|
|
|
|
|
|
|
console.error('=================================');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Alert.error(`${errCode}: ${errMsg}`);
|
|
|
|
Swal.fire({
|
|
|
|
Swal.fire({
|
|
|
|
icon: 'error',
|
|
|
|
icon: 'error',
|
|
|
|
title: 'Api Error',
|
|
|
|
title: 'Api Error',
|
|
|
|
html: errMsg,
|
|
|
|
html: `${errMsg} [ ${errCode} ]`,
|
|
|
|
// imageUrl:
|
|
|
|
// imageUrl:
|
|
|
|
timer: 5000
|
|
|
|
timer: 5000
|
|
|
|
}).then((r) => r);
|
|
|
|
}).then((r) => r);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (response) {
|
|
|
|
if (error.isAxiosError) {
|
|
|
|
const errCode = response.data.code;
|
|
|
|
let errMsg = `시스템 에러~~~~~~~~~~~~`;
|
|
|
|
const errMsg = response.data.error;
|
|
|
|
if (error.code === 'ECONNABORTED') errMsg = 'Server time out';
|
|
|
|
console.error(`${errCode}: ${errMsg}`);
|
|
|
|
|
|
|
|
console.error('=================================');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Alert.error(`${errCode}: ${errMsg}`);
|
|
|
|
|
|
|
|
Swal.fire({
|
|
|
|
Swal.fire({
|
|
|
|
icon: 'error',
|
|
|
|
icon: 'error',
|
|
|
|
title: 'Api Error',
|
|
|
|
title: 'Api Error',
|
|
|
|
html: `${errCode}: ${errMsg}`,
|
|
|
|
html: errMsg,
|
|
|
|
// imageUrl:
|
|
|
|
// imageUrl:
|
|
|
|
timer: 5000
|
|
|
|
timer: 5000
|
|
|
|
}).then((r) => r);
|
|
|
|
}).then((r) => r);
|
|
|
|