Skip to content

Commit

Permalink
Move AbortController into makeJottingsRequests()
Browse files Browse the repository at this point in the history
  • Loading branch information
varunsingh87 committed May 2, 2021
1 parent 725c0a5 commit 8ac4e7d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions components/JottingsControls/jottingsControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,15 @@ import { compareArrays } from "../../libs/arrayExtensions";
export default function JottingsControl(props) {
const [notes, setNotes] = useState(null);
const [tasks, setTasks] = useState(null);

const ownAbortController = new window.AbortController();
const sharedAbortController = new window.AbortController();


const getJotsToShow = (response, jotType) => {
if (
response[1].status === "rejected" &&
response[0].status === "fulfilled"
)
)
return response[0].value[jotType];
else if (
response[1].status === "fulfilled" &&
else if (
response[1].status === "fulfilled" &&
response[0].status === "fulfilled"
)
return [...response[0].value[jotType], ...response[1].value[jotType]];
Expand All @@ -35,6 +32,9 @@ export default function JottingsControl(props) {
};

const makeJottingsRequests = async (interval) => {
const ownAbortController = new AbortController();
const sharedAbortController = new AbortController();

if (notes === -1 || tasks === -1) {
console.info("Interval cleared due to errors");
clearInterval(interval);
Expand Down

0 comments on commit 8ac4e7d

Please sign in to comment.