fix: App soft crash when deleting servers (#492)

Co-authored-by: Paul Makles <paulmakles@gmail.com>
This commit is contained in:
Ryan Alexander 2022-01-06 20:35:07 +10:00 committed by GitHub
parent 8c1f5dfb68
commit cf55921077
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -81,6 +81,7 @@ type SpecialProps = { onClose: () => void } & (
export const SpecialPromptModal = observer((props: SpecialProps) => {
const client = useContext(AppContext);
const history = useHistory();
const [processing, setProcessing] = useState(false);
const [error, setError] = useState<undefined | string>(undefined);
@ -157,6 +158,8 @@ export const SpecialPromptModal = observer((props: SpecialProps) => {
case "delete_channel":
case "leave_server":
case "delete_server":
if (props.type != "delete_channel")
history.push("/");
props.target.delete();
break;
case "delete_bot":