Skip to content

Commit f429954

Browse files
committed
handle 202 response from api correctly
1 parent 0aeb61a commit f429954

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

src/components/stickybanMatch.tsx

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -95,16 +95,12 @@ const Whitelist = (props: { ckey: string }) => {
9595
callApi(`/Stickyban/Whitelist?ckey=${ckey}`, {
9696
method: "POST",
9797
}).then((value) => {
98-
value.text().then((value) => {
99-
setOpen(false);
100-
if (value) {
101-
global?.updateAndShowToast(
102-
`Whitelisted ${ckey} against ${value} stickybans.`
103-
);
104-
} else {
105-
global?.updateAndShowToast(`No stickybans lifted for ${ckey}.`);
106-
}
107-
});
98+
setOpen(false);
99+
if (value.status == 202) {
100+
global?.updateAndShowToast(`Whitelisted ${ckey}.`);
101+
} else {
102+
global?.updateAndShowToast(`No stickybans lifted for ${ckey}.`);
103+
}
108104
});
109105
};
110106

0 commit comments

Comments
 (0)