Last active
January 13, 2021 17:21
-
-
Save polluterofminds/843bb711958f4cac9365acafce6e8cf1 to your computer and use it in GitHub Desktop.
Load All Posts Action
This file contains 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
export const loadAllPosts = async () => { | |
try { | |
const token = localStorage.getItem("pinnie-token"); | |
const config = { | |
headers: { | |
"token": token, | |
"Content-Type": "application/json" | |
} | |
} | |
const res = await axios.get("/api/posts", config); | |
return res.data; | |
} catch (error) { | |
console.log(error); | |
return []; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment