Skip to content

Commit

Permalink
Merge pull request #235 from Infosys/develop
Browse files Browse the repository at this point in the history
[INJIWEB-1167]: Updated for MultiLingual support for credential download as pdf
  • Loading branch information
Gurpreet41082 authored Jan 15, 2025
2 parents 5d9048b + 99762b9 commit 3e27cc9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
7 changes: 4 additions & 3 deletions inji-web/src/pages/RedirectionPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => {

Expand All @@ -22,13 +24,12 @@ export const RedirectionPage: React.FC = () => {
const [session, setSession] = useState<SessionObject | null>(activeSessionInfo);
const [completedDownload, setCompletedDownload] = useState<boolean>(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) {
Expand All @@ -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(),
Expand Down
5 changes: 3 additions & 2 deletions inji-web/src/utils/misc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,16 @@ 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,
'redirect_uri': api.authorizationRedirectionUrl,
'code_verifier': codeVerifier,
'issuer': issuerId,
'credential': credentialType,
'vcStorageExpiryLimitInTimes': vcStorageExpiryLimitInTimes
'vcStorageExpiryLimitInTimes': vcStorageExpiryLimitInTimes,
'locale':locale
}
}

Expand Down

0 comments on commit 3e27cc9

Please sign in to comment.