Skip to content

Commit

Permalink
rm unused func
Browse files Browse the repository at this point in the history
  • Loading branch information
FZambia committed Jan 8, 2024
1 parent 5a0f3e0 commit 6f74ab9
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions src/utils/Functions.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
import { useContext } from 'react'
import { AdminSettingsContext } from 'contexts/AdminSettingsContext'

import { useAuth } from 'react-oidc-context'

function pad(n) {
// http://stackoverflow.com/a/3313953/1288429
return `0${n}`.slice(-2)
Expand Down Expand Up @@ -80,22 +75,3 @@ export function RandomString(length) {
}
return result.join('')
}

export function RequestHeaders() {
const adminSettingsContext = useContext(AdminSettingsContext)
const adminSettings = adminSettingsContext.getAdminSettings()
const insecure = adminSettings.insecure
const useIDP = adminSettings.oidc !== undefined
const auth = useAuth()
const headers = {
Accept: 'application/json',
}
if (!insecure) {
if (useIDP) {
headers.Authorization = `Bearer ${auth.user.access_token}`
} else {
headers.Authorization = `token ${localStorage.getItem('token')}`
}
}
return headers
}

0 comments on commit 6f74ab9

Please sign in to comment.