Skip to content

Commit

Permalink
fix: suppression de l'ajout auto du header pour l'access token
Browse files Browse the repository at this point in the history
  • Loading branch information
remy-auricoste committed Nov 15, 2023
1 parent c45e847 commit e28f31e
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions ui/utils/api.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@ async function optionsToFetchParams(method: RequestInit["method"], options: IReq
})
}

const accessToken = getAccessToken()
if (accessToken && !headers.has("authorization")) {
headers.append("authorization", `Bearer ${accessToken}`)
}

let body: BodyInit | undefined = undefined
if ("body" in options && method !== "GET") {
if (options.body instanceof FormData) {
Expand Down Expand Up @@ -84,13 +79,6 @@ async function getHeaders(options: IRequestOptions) {

const removeAtEnd = (url: string, removed: string): string => (url.endsWith(removed) ? url.slice(0, -removed.length) : url)

const getAccessToken = () => {
if (typeof window !== "undefined") {
const token = new URLSearchParams(window.location.search).get("token")
return token
}
}

export function generateUrl(path: string, options: WithQueryStringAndPathParam = {}): string {
const params = "params" in options ? options.params : {}
const querystring = "querystring" in options ? options.querystring : {}
Expand Down

0 comments on commit e28f31e

Please sign in to comment.