Skip to content

Instantly share code, notes, and snippets.

@polluterofminds
Last active January 13, 2021 17:21
Show Gist options
  • Save polluterofminds/843bb711958f4cac9365acafce6e8cf1 to your computer and use it in GitHub Desktop.
Save polluterofminds/843bb711958f4cac9365acafce6e8cf1 to your computer and use it in GitHub Desktop.
Load All Posts Action
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