Skip to content

Instantly share code, notes, and snippets.

@polluterofminds
Created January 13, 2021 16:12
Show Gist options
  • Save polluterofminds/c76cbe48fe5f5c0d7da41e1ac791bef2 to your computer and use it in GitHub Desktop.
Save polluterofminds/c76cbe48fe5f5c0d7da41e1ac791bef2 to your computer and use it in GitHub Desktop.
Validate Token Action
export const validateToken = async (token) => {
try {
const data = {
token
}
const res = await axios.post("api/validate", data);
if(res.data === "OK") {
localStorage.setItem("pinnie-token", token);
} else {
return false;
}
return true;
} catch (error) {
throw error;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment