-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
avoid using boolean values in envvars as yaml, ansible, .env evaluate them differently
- Loading branch information
1 parent
8e616fe
commit b63a90b
Showing
3 changed files
with
11 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,9 @@ | ||
import type { Selector } from "@/types"; | ||
import type { ApiToken, AuthState } from "./types"; | ||
import type { User } from 'hds-react'; | ||
import { useTunnistamoOpenIdConnect } from "@/auth/constants"; | ||
import { apiTokenKeyName } from "@/auth/constants"; | ||
// Helper functions to select state | ||
export const getApiToken: Selector<ApiToken, void> = (state: Record<string, any>): AuthState => { | ||
if (useTunnistamoOpenIdConnect) { | ||
return state.auth.apiToken[import.meta.env.VITE_OPENID_CONNECT_API_TOKEN_KEY || 'https://api.hel.fi/auth/mvj']; | ||
} | ||
return state.auth.apiToken[import.meta.env.VITE_TUNNISTUS_OIDC_API_AUDIENCE || 'mvj-api']; | ||
return state.auth.apiToken[apiTokenKeyName]; | ||
}; | ||
export const getLoggedInUser: Selector<Record<string, any>, void> = (state: Record<string, any>): User | null => state.auth.user; |