mirror of
https://github.com/stoatchat/for-legacy-web.git
synced 2026-03-07 09:25:27 +00:00
Port settings.
This commit is contained in:
23
src/pages/settings/server/Bans.tsx
Normal file
23
src/pages/settings/server/Bans.tsx
Normal file
@@ -0,0 +1,23 @@
|
||||
import { Servers } from "revolt.js/dist/api/objects";
|
||||
import { useContext, useEffect, useState } from "preact/hooks";
|
||||
import { AppContext } from "../../../context/revoltjs/RevoltClient";
|
||||
|
||||
interface Props {
|
||||
server: Servers.Server;
|
||||
}
|
||||
|
||||
export function Bans({ server }: Props) {
|
||||
const client = useContext(AppContext);
|
||||
const [bans, setBans] = useState<Servers.Ban[] | undefined>(undefined);
|
||||
|
||||
useEffect(() => {
|
||||
client.servers.fetchBans(server._id)
|
||||
.then(bans => setBans(bans))
|
||||
}, [ ]);
|
||||
|
||||
return (
|
||||
<div>
|
||||
{ bans?.map(x => <div>{x._id.user}: {x.reason ?? 'no reason'} <button onClick={() => client.servers.unbanUser(server._id, x._id.user)}>unban</button></div>) }
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user