mirror of
https://github.com/supabase/supabase.git
synced 2026-05-07 17:30:25 -04:00
3b3a75202e
* feat: add auth reports * fix reports dates, fix missing queries * add flag * fix errorbystatus chart * fix sign in by grant type * move formatting to auth report query file * fix signup by provider, add ratelimitted reqs * fix sign ups query * cleanup unused stuff * cleanup * rm console logs * undo logs.utils * add status code lib, use edge_logs for query * fix auth error chart footer * rm redundant rate limited requests chart * fix db report breaking due to useAuthReport throwing * move state up, reduce conditional logic in composed chart handler * reorder reports nav * rm bg * fix type err * fix useChartData * empty * fix report header bg * move to utils * add AnalyticsInterval import to report.utils for granularity conversion
31 lines
743 B
TypeScript
31 lines
743 B
TypeScript
import { status } from 'http-status'
|
|
|
|
export function getHttpStatusCodeInfo(codeNumber: number): {
|
|
code: number
|
|
name: string
|
|
message: string
|
|
label: string
|
|
} {
|
|
type StatusCodeKey = keyof typeof status
|
|
|
|
if (!(codeNumber in status)) {
|
|
return {
|
|
code: codeNumber,
|
|
name: 'UNKNOWN',
|
|
message: 'Unknown status code',
|
|
label: 'Unknown',
|
|
}
|
|
}
|
|
|
|
const statusCodeLabel = status[codeNumber as StatusCodeKey]
|
|
const statusCodeMessage = status[`${codeNumber}_MESSAGE` as StatusCodeKey]
|
|
const statusCodeName = status[`${codeNumber}_NAME` as StatusCodeKey]
|
|
|
|
return {
|
|
code: codeNumber,
|
|
name: statusCodeName as string,
|
|
label: statusCodeLabel as string,
|
|
message: statusCodeMessage as string,
|
|
}
|
|
}
|