Skip to content

Instantly share code, notes, and snippets.

@joshmenden
Last active September 3, 2022 01:22
Show Gist options
  • Save joshmenden/d678632334a4fca94de3f1773a9856cd to your computer and use it in GitHub Desktop.
Save joshmenden/d678632334a4fca94de3f1773a9856cd to your computer and use it in GitHub Desktop.
async function getHeaders() {
const headers = {}
const jwt = // whatever logic you need to fetch your JWT, possible from pinia etc
if (jwt) {
headers['Authorization'] = `Bearer ${jwt}`
}
headers['Content-Type'] = 'application/json'
return headers
}
const defaultOptions = {
query: {
errorPolicy: 'all',
},
mutate: {
errorPolicy: 'all',
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment