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

View file

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

View file

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

View file

@ -26,7 +26,7 @@ export function UserPicker(props: Props) {
actions={[ actions={[
{ {
children: <Text id="app.special.modals.actions.ok" />, 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}> <div className={styles.list}>

View file

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

View file

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