Last active
March 8, 2016 15:49
-
-
Save neurosnap/67ccd82dc1b106360bc2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function getThreads(api, dispatch) { | |
try { | |
let mailboxes = await api.get(`mailboxes`); | |
mailboxes = mailboxes.mailboxes; | |
for (let i = 0; i < mailboxes.length; i++) { | |
let box = mailboxes[i]; | |
let inbox = await api.get(`mailboxes/${box.id}/threads/folder/in`); | |
for (let i = 0; i < inbox.threads.length; i++) { | |
let thread = { ...inbox.threads[i] }; | |
combineThreadWithPreview(thread, inbox.linked.messages); | |
dispatch(addThread(thread)); | |
} | |
} | |
} catch (err) { | |
console.log(err); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment