diff --git a/inji-web/src/pages/RedirectionPage.tsx b/inji-web/src/pages/RedirectionPage.tsx index c6d51749..c1a7d03f 100644 --- a/inji-web/src/pages/RedirectionPage.tsx +++ b/inji-web/src/pages/RedirectionPage.tsx @@ -9,6 +9,8 @@ import {SessionObject} from "../types/data"; import {useTranslation} from "react-i18next"; import {downloadCredentialPDF, getErrorObject, getTokenRequestBody} from "../utils/misc"; import {getObjectForCurrentLanguage} from "../utils/i18n"; +import { RootState } from '../types/redux'; +import { useSelector } from 'react-redux' export const RedirectionPage: React.FC = () => { @@ -22,13 +24,12 @@ export const RedirectionPage: React.FC = () => { const [session, setSession] = useState(activeSessionInfo); const [completedDownload, setCompletedDownload] = useState(false); const displayObject = getObjectForCurrentLanguage(session?.selectedIssuer?.display ?? []); + const language = useSelector((state: RootState) => state.common.language); const [errorObj, setErrorObj] = useState({ code: "error.generic.title", message: "error.generic.subTitle" }) - - useEffect(() => { const fetchToken = async () => { if (Object.keys(activeSessionInfo).length > 0) { @@ -39,7 +40,7 @@ export const RedirectionPage: React.FC = () => { const certificateId = activeSessionInfo?.certificateId; const vcStorageExpiryLimitInTimes = activeSessionInfo?.vcStorageExpiryLimitInTimes ?? "-1"; - const requestBody = new URLSearchParams(getTokenRequestBody(code, codeVerifier, issuerId, certificateId, vcStorageExpiryLimitInTimes)); + const requestBody = new URLSearchParams(getTokenRequestBody(code, codeVerifier, issuerId, certificateId, vcStorageExpiryLimitInTimes,language)); const apiRequest = api.fetchTokenAnddownloadVc; let credentialDownloadResponse = await fetchRequest( apiRequest.url(), diff --git a/inji-web/src/utils/misc.ts b/inji-web/src/utils/misc.ts index a5008863..3d21a256 100644 --- a/inji-web/src/utils/misc.ts +++ b/inji-web/src/utils/misc.ts @@ -29,7 +29,7 @@ export const isObjectEmpty = (object: any) => { return object === null || object === undefined || Object.keys(object).length === 0; } -export const getTokenRequestBody = (code: string, codeVerifier: string, issuerId: string, credentialType: string, vcStorageExpiryLimitInTimes: string) => { +export const getTokenRequestBody = (code: string, codeVerifier: string, issuerId: string, credentialType: string, vcStorageExpiryLimitInTimes: string, locale: string) => { return { 'grant_type': 'authorization_code', 'code': code, @@ -37,7 +37,8 @@ export const getTokenRequestBody = (code: string, codeVerifier: string, issuerId 'code_verifier': codeVerifier, 'issuer': issuerId, 'credential': credentialType, - 'vcStorageExpiryLimitInTimes': vcStorageExpiryLimitInTimes + 'vcStorageExpiryLimitInTimes': vcStorageExpiryLimitInTimes, + 'locale':locale } }