Show error alert when data is not available

This commit is contained in:
Ken Hibino
2021-01-09 13:48:49 -08:00
parent 933127cc0e
commit 251b262798
13 changed files with 230 additions and 123 deletions

View File

@@ -1,3 +1,14 @@
import { AxiosError } from "axios";
// toErrorString returns a string representaion of axios error.
export function toErrorString(error: AxiosError<string>): string {
const { response } = error;
if (!response) {
return "error: no error response data available";
}
return `${response.status} (${response.statusText}): ${response.data}`;
}
interface Duration {
hour: number;
minute: number;