mirror of
https://github.com/coder/coder.git
synced 2026-11-02 21:50:08 +08:00
17 lines
367 B
TypeScript
17 lines
367 B
TypeScript
import type { ThemeRole } from "#/theme/roles";
|
|
|
|
export const httpStatusColor = (httpStatus: number): ThemeRole => {
|
|
// Treat server errors (500) as errors
|
|
if (httpStatus >= 500) {
|
|
return "error";
|
|
}
|
|
|
|
// Treat client errors (400) as warnings
|
|
if (httpStatus >= 400) {
|
|
return "warning";
|
|
}
|
|
|
|
// OK (200) and redirects (300) are successful
|
|
return "success";
|
|
};
|