Skip to content

Commit

Permalink
feat: include X-QCExt-Version with API calls like the old script did
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyvion committed Sep 9, 2023
1 parent c3e6839 commit 876f88c
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/store/apiSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,23 @@ const greasemonkeyBaseQuery = ({
}): GreasemonkeyBaseQuery => {
return async ({ url, configuration }, _api, _extraOptions) => {
const requestUrl = `${baseUrl}${url}`

if (!configuration) {
configuration = {
headers: {
'X-QCExt-Version': GM.info.script.version,
},
}
} else {
configuration = {
...configuration,
headers: {
...(configuration.headers ?? {}),
'X-QCExt-Version': GM.info.script.version,
},
}
}

let response
try {
response = await gmFetch(requestUrl, configuration)
Expand Down

0 comments on commit 876f88c

Please sign in to comment.