create-electron-foundation
Version:
An interactive CLI to bootstrap a modern, type-safe, and scalable Electron application.
26 lines (22 loc) • 378 B
text/typescript
interface ResponseOk<T = unknown> {
code?: number
msg?: string
data?: T
}
interface ResponseError {
code?: number
msg?: string
}
export const response = {
ok: <T = unknown>(data?: ResponseOk<T>) => ({
code: 200,
msg: 'SUCCESS',
data: null,
...data,
}),
error: (data?: ResponseError) => ({
code: 500,
msg: 'ERROR',
...data,
}),
}