Skip to content

Commit

Permalink
feat(sudt-manager): add response formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
Daryl-L committed Oct 12, 2023
1 parent 77e2c73 commit 95a0924
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/samples/sudt/response.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export class SudtResponse<T> {
constructor(
private code: string,
private data: T,
) {}

static ok<T>(data: T) {
return new SudtResponse<T>('200', data)
}

static err<T>(code: string, data: T) {
return new SudtResponse<T>(code, data)
}
}

0 comments on commit 95a0924

Please sign in to comment.