mirror of
https://github.com/revoltchat/revite.git
synced 2024-12-25 23:22:06 -05:00
fix typing errors
This commit is contained in:
parent
4bdc29c9d6
commit
3ad20d6e96
1 changed files with 6 additions and 4 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue