Skip to content

Commit

Permalink
fix: change return types of header functions
Browse files Browse the repository at this point in the history
  • Loading branch information
simonseyock committed Jun 13, 2024
1 parent 851fd3f commit 48d45e5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
8 changes: 2 additions & 6 deletions src/security/getBearerTokenHeader.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
import Keycloak from 'keycloak-js';

export interface BearerTokenHeader {
'Authorization': string;
}

export const getBearerTokenHeader = (keycloak?: Keycloak): BearerTokenHeader | undefined => {
export const getBearerTokenHeader = (keycloak?: Keycloak): Record<string, string> => {
let accessToken = keycloak?.token;

if (!accessToken) {
return;
return {};
}

return {
Expand Down
8 changes: 2 additions & 6 deletions src/security/getCsrfTokenHeader.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
import CsrfUtil from '@terrestris/base-util/dist/CsrfUtil/CsrfUtil';

export interface CsrfTokenHeader {
'X-XSRF-TOKEN': string;
}

export const getCsrfTokenHeader = (): CsrfTokenHeader | undefined => {
export const getCsrfTokenHeader = (): Record<string, string> => {
let csrfToken = CsrfUtil.getCsrfValueFromCookie();

if (!csrfToken) {
csrfToken = CsrfUtil.getCsrfValue();
}

if (!csrfToken) {
return;
return {};
}

return {
Expand Down

0 comments on commit 48d45e5

Please sign in to comment.