const [tournament, setTournament] = useState(null);
useEffect(() => {
+ const ctrl = new AbortController();
setLoading(true);
axios
- .get(`/api/tournaments/${id}`)
+ .get(`/api/tournaments/${id}`, { signal: ctrl.signal })
.then(response => {
setError(null);
setLoading(false);
setLoading(false);
setTournament(null);
});
+ return () => {
+ ctrl.abort();
+ };
}, [id]);
useEffect(() => {
useEffect(() => {
setLoading(true);
+ const ctrl = new AbortController();
axios
- .get(`/api/users/${id}`)
+ .get(`/api/users/${id}`, { signal: ctrl.signal })
.then(response => {
setError(null);
setLoading(false);
setLoading(false);
setUser(null);
});
+ return () => {
+ ctrl.abort();
+ };
}, [id]);
useEffect(() => {
const [protocol, setProtocol] = useState([]);
useEffect(() => {
+ const ctrl = new AbortController();
axios
- .get(`/api/protocol/${id}`)
+ .get(`/api/protocol/${id}`, { signal: ctrl.signal })
.then(response => {
setProtocol(response.data);
});
+ return () => {
+ ctrl.abort();
+ };
}, [id]);
useEffect(() => {