mirror of
https://github.com/stoatchat/for-legacy-web.git
synced 2026-03-07 17:35:28 +00:00
fix typing errors
This commit is contained in:
@@ -23,6 +23,7 @@ import Checkbox from "../../../components/ui/Checkbox";
|
|||||||
import InputBox from "../../../components/ui/InputBox";
|
import InputBox from "../../../components/ui/InputBox";
|
||||||
import Tip from "../../../components/ui/Tip";
|
import Tip from "../../../components/ui/Tip";
|
||||||
import CategoryButton from "../../../components/ui/fluent/CategoryButton";
|
import CategoryButton from "../../../components/ui/fluent/CategoryButton";
|
||||||
|
import type { AxiosError } from "axios";
|
||||||
|
|
||||||
interface Data {
|
interface Data {
|
||||||
_id: string;
|
_id: string;
|
||||||
@@ -92,16 +93,17 @@ function BotCard({ bot, onDelete, onUpdate }: Props) {
|
|||||||
onUpdate(changes);
|
onUpdate(changes);
|
||||||
setEditMode(false);
|
setEditMode(false);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e.isAxiosError && e.response.data?.type) {
|
const err = e as AxiosError;
|
||||||
switch (e.response.data.type) {
|
if (err.isAxiosError && err.response?.data?.type) {
|
||||||
|
switch (err.response.data.type) {
|
||||||
case "UsernameTaken":
|
case "UsernameTaken":
|
||||||
setError("That username is taken!");
|
setError("That username is taken!");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
setError(`Error: ${e.response.data.type}`);
|
setError(`Error: ${err.response.data.type}`);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else setError(e.toString());
|
} else setError(err.toString());
|
||||||
}
|
}
|
||||||
setSaving(false);
|
setSaving(false);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user