All files / src/types/service common.ts

69.56% Statements 16/23
100% Branches 0/0
0% Functions 0/1
69.56% Lines 16/23

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 241x 1x 1x 1x 1x 1x 1x 1x 1x               1x 1x 1x 1x 1x 1x 1x  
export class CommonErrorResponse {
  type: string;
  title: string;
  status: number;
  detail: string;
  instance: string;
  errorCode: string;
 
  constructor(data?: Partial<CommonErrorResponse>) {
    this.type = data?.type ?? 'about:blank';
    this.title = data?.title ?? 'Network Error';
    this.status = data?.status ?? 0;
    this.detail = data?.detail ?? '서버와 연결할 수 없습니다.';
    this.instance = data?.instance ?? '';
    this.errorCode = data?.errorCode ?? 'NETWORK_ERROR';
  }
}
 
export interface CommonSuccessResponse<T> {
  status: number;
  success: boolean;
  data: T;
}