Skip to content

Instantly share code, notes, and snippets.

@fredriccliver
Last active November 6, 2020 17:19
Show Gist options
  • Save fredriccliver/13756dc2aac75fe18639c6a4f6569a5c to your computer and use it in GitHub Desktop.
Save fredriccliver/13756dc2aac75fe18639c6a4f6569a5c to your computer and use it in GitHub Desktop.
let option = {}
if (locale) {
let token = await firebase.auth().currentUser?.getIdToken()
option = {
params: { yourParam: valueOfParam },
headers: {
Authorization: `Bearer ${token}`
}
}
}
axios
.get("/endpoint", option)
.then((result) => {
// do with result
})
.catch((e) => {
// do with error
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment