chore: fix build errors

This commit is contained in:
Paul Makles 2022-06-10 17:00:37 +01:00
parent 277eaa685d
commit 71f8fc86a4
6 changed files with 25 additions and 12 deletions

View file

@ -168,10 +168,11 @@ export const SpecialPromptModal = observer((props: SpecialProps) => {
break;
}
onClose();
return true;
} catch (err) {
setError(takeError(err));
setProcessing(false);
return false;
}
},
},
@ -210,10 +211,11 @@ export const SpecialPromptModal = observer((props: SpecialProps) => {
try {
props.target.delete();
onClose();
return true;
} catch (err) {
setError(takeError(err));
setProcessing(false);
return false;
}
},
},
@ -316,10 +318,11 @@ export const SpecialPromptModal = observer((props: SpecialProps) => {
})
?.kick();
onClose();
return true;
} catch (err) {
setError(takeError(err));
setProcessing(false);
return false;
}
},
},
@ -366,10 +369,12 @@ export const SpecialPromptModal = observer((props: SpecialProps) => {
await props.target.banUser(props.user._id, {
reason,
});
onClose();
return true;
} catch (err) {
setError(takeError(err));
setProcessing(false);
return false;
}
},
},
@ -438,10 +443,11 @@ export const SpecialPromptModal = observer((props: SpecialProps) => {
);
}
onClose();
return true;
} catch (err) {
setError(takeError(err));
setProcessing(false);
return false;
}
},
},
@ -512,11 +518,13 @@ export const SpecialPromptModal = observer((props: SpecialProps) => {
},
],
});
onClose();
setProcessing(false);
return true;
} catch (err) {
setError(takeError(err));
setProcessing(false);
return false;
}
},
},

View file

@ -29,7 +29,6 @@ export function CreateBotModal({ onClose, onCreate }: Props) {
try {
const { bot } = await client.bots.create({ name });
onCreate(bot);
onClose();
} catch (err) {
setError(takeError(err));
}
@ -43,7 +42,10 @@ export function CreateBotModal({ onClose, onCreate }: Props) {
{
confirmation: true,
palette: "accent",
onClick: handleSubmit(onSubmit),
onClick: async () => {
await handleSubmit(onSubmit);
return true;
},
children: <Text id="app.special.modals.actions.create" />,
},
{

View file

@ -74,7 +74,10 @@ export function ModifyAccountModal({ onClose, field }: Props) {
actions={[
{
confirmation: true,
onClick: handleSubmit(onSubmit),
onClick: async () => {
await handleSubmit(onSubmit);
return true;
},
children:
field === "email" ? (
<Text id="app.special.modals.actions.send_email" />

View file

@ -26,7 +26,7 @@ export function UserPicker(props: Props) {
actions={[
{
children: <Text id="app.special.modals.actions.ok" />,
onClick: () => props.callback(selected).then(props.onClose),
onClick: () => props.callback(selected).then(() => true),
},
]}>
<div className={styles.list}>

View file

@ -278,7 +278,7 @@ export default observer(() => {
</a>
<LineDivider />
<ButtonItem
onClick={logout}
onClick={() => logout()}
className={styles.logOut}
compact>
<LogOut size={20} />

View file

@ -1,6 +1,6 @@
// TODO: re-export from revolt-api in some way
declare type Session = {
_id: string;
_id?: string;
token: string;
name: string;
user_id: string;