Skip to content

Commit 00338e4

Browse files
committed
Automatically hide the kill modal when server stops
1 parent 76f3b99 commit 00338e4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

resources/scripts/components/server/console/PowerButtons.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useState } from 'react';
1+
import React, { useEffect, useState } from 'react';
22
import { Button } from '@/components/elements/button/index';
33
import Can from '@/components/elements/Can';
44
import { ServerContext } from '@/state/server';
@@ -27,6 +27,12 @@ export default ({ className }: PowerButtonProps) => {
2727
}
2828
};
2929

30+
useEffect(() => {
31+
if (status === 'offline') {
32+
setOpen(false);
33+
}
34+
}, [ status ]);
35+
3036
return (
3137
<div className={className}>
3238
<Dialog.Confirm

0 commit comments

Comments
 (0)