@@ -5,6 +5,7 @@ import OauthInjectedService from './OauthInjectedService'
55import { AxiosResponse } from 'axios'
66import axios from 'axios'
77import { Session } from 'express-session'
8+ import { DEFAULT_OBP_API_VERSION } from '../../shared-constants'
89
910@Service ( )
1011/**
@@ -79,7 +80,7 @@ export default class OBPConsentsService {
7980 // I.e. give permission to Opey to do anything on behalf of the logged in user
8081
8182 // Get the Consents API client from the OBP SDK
82- const client = await this . createUserConsentsClient ( session , `/obp/${ process . env . VITE_OBP_API_VERSION } /my/consents/IMPLICIT` , 'POST' )
83+ const client = await this . createUserConsentsClient ( session , `/obp/${ process . env . VITE_OBP_API_VERSION ?? DEFAULT_OBP_API_VERSION } /my/consents/IMPLICIT` , 'POST' )
8384 if ( ! client ) {
8485 throw new Error ( 'Could not create Consents API client' )
8586 }
@@ -150,7 +151,7 @@ export default class OBPConsentsService {
150151 }
151152
152153 try {
153- const response = await this . _sendOBPRequest ( `/obp/${ process . env . VITE_OBP_API_VERSION } /user/current/consents/${ consentId } ` , 'GET' , clientConfig )
154+ const response = await this . _sendOBPRequest ( `/obp/${ process . env . VITE_OBP_API_VERSION ?? DEFAULT_OBP_API_VERSION } /user/current/consents/${ consentId } ` , 'GET' , clientConfig )
154155
155156 session [ 'opeyConfig' ] = {
156157 authConfig : {
@@ -182,7 +183,7 @@ export default class OBPConsentsService {
182183
183184 // Get the Consents API client from the OBP SDK
184185 // The OBP SDK is messed up here, so we'll need to use Fetch until the SWAGGER WILL ACTUALLY WORK
185- // const client = await this.createUserConsentsClient(session, `/obp/${process.env.VITE_OBP_API_VERSION}/my/consents/IMPLICIT`, 'POST')
186+ // const client = await this.createUserConsentsClient(session, `/obp/${process.env.VITE_OBP_API_VERSION ?? DEFAULT_OBP_API_VERSION }/my/consents/IMPLICIT`, 'POST')
186187 // if (!client) {
187188 // throw new Error('Could not create Consents API client')
188189 // }
@@ -197,8 +198,8 @@ export default class OBPConsentsService {
197198
198199 // We need to change this back to consent infos once OBP shows 'EXPIRED' in the status
199200 // Right now we have to check the JWT ourselves
200- const consentInfosPath = `/obp/${ process . env . VITE_OBP_API_VERSION } /my/consents`
201- //const consentInfosPath = `/obp/${process.env.VITE_OBP_API_VERSION}/my/consent-infos`
201+ const consentInfosPath = `/obp/${ process . env . VITE_OBP_API_VERSION ?? DEFAULT_OBP_API_VERSION } /my/consents`
202+ //const consentInfosPath = `/obp/${process.env.VITE_OBP_API_VERSION ?? DEFAULT_OBP_API_VERSION }/my/consent-infos`
202203
203204 let opeyConsentId : string | null = null
204205 try {
0 commit comments