Created
January 13, 2021 16:12
-
-
Save polluterofminds/c76cbe48fe5f5c0d7da41e1ac791bef2 to your computer and use it in GitHub Desktop.
Validate Token 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 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