-แก้ไขระบบ trow api และ ยิง

This commit is contained in:
x2Skyz
2025-11-16 21:45:57 +07:00
parent 60662d88d4
commit ccab40852c
9 changed files with 786 additions and 7 deletions

View File

@@ -54,8 +54,14 @@ export class GeneralService {
return this.http.post(fullUrl, payload, this.getHttpOptions()).pipe(
map((res: any) => res),
catchError((error: any) => {
const response = error?.error;
console.error('❌ [POST Request Error]:', error);
return throwError(() => error);
return throwError(() => ({
status: error.status,
code: response?.code ?? '500',
message: response?.message ?? 'Internal Server Error',
message_th: response?.message_th ?? 'เกิดข้อผิดพลาดภายในเซิร์ฟเวอร์'
}));
})
);
}
@@ -66,9 +72,14 @@ export class GeneralService {
return this.http.get(fullUrl, this.getHttpOptions()).pipe(
map((res: any) => res),
catchError((error: any) => {
const response = error?.error;
console.error('❌ [GET Request Error]:', error);
return throwError(() => error);
})
return throwError(() => ({
status: error.status,
code: response?.code ?? '500',
message: response?.message ?? 'Internal Server Error',
message_th: response?.message_th ?? 'เกิดข้อผิดพลาดภายในเซิร์ฟเวอร์'
})); })
);
}