Automatically hide the kill modal when server stops

This commit is contained in:
DaneEveritt 2022-06-25 21:29:41 -04:00
parent 76f3b996fe
commit 00338e431b
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53

View file

@ -1,4 +1,4 @@
import React, { useState } from 'react'; import React, { useEffect, useState } from 'react';
import { Button } from '@/components/elements/button/index'; import { Button } from '@/components/elements/button/index';
import Can from '@/components/elements/Can'; import Can from '@/components/elements/Can';
import { ServerContext } from '@/state/server'; import { ServerContext } from '@/state/server';
@ -27,6 +27,12 @@ export default ({ className }: PowerButtonProps) => {
} }
}; };
useEffect(() => {
if (status === 'offline') {
setOpen(false);
}
}, [ status ]);
return ( return (
<div className={className}> <div className={className}>
<Dialog.Confirm <Dialog.Confirm