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 Tip from "../../../components/ui/Tip";
|
||||
import CategoryButton from "../../../components/ui/fluent/CategoryButton";
|
||||
import type { AxiosError } from "axios";
|
||||
|
||||
interface Data {
|
||||
_id: string;
|
||||
|
@ -92,16 +93,17 @@ function BotCard({ bot, onDelete, onUpdate }: Props) {
|
|||
onUpdate(changes);
|
||||
setEditMode(false);
|
||||
} catch (e) {
|
||||
if (e.isAxiosError && e.response.data?.type) {
|
||||
switch (e.response.data.type) {
|
||||
const err = e as AxiosError;
|
||||
if (err.isAxiosError && err.response?.data?.type) {
|
||||
switch (err.response.data.type) {
|
||||
case "UsernameTaken":
|
||||
setError("That username is taken!");
|
||||
break;
|
||||
default:
|
||||
setError(`Error: ${e.response.data.type}`);
|
||||
setError(`Error: ${err.response.data.type}`);
|
||||
break;
|
||||
}
|
||||
} else setError(e.toString());
|
||||
} else setError(err.toString());
|
||||
}
|
||||
setSaving(false);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue