Home > Back-end >  Syntax error Invalid Regular expression angular typescript
Syntax error Invalid Regular expression angular typescript

Time:11-28

i am getting this error and i am stuck cant find where is the syntax problem

core.mjs:6495 ERROR SyntaxError: Invalid regular expression: /https://graph.microsoft.com/v1.0/communications/callRecords/getPstnCalls(fromDateTime=2020-01-30,toDateTime=2020-01-30/: Unterminated group at new RegExp () at Function.StringUtils.matchPattern (StringUtils.js:122) at azure-msal-angular.js:425 at Array.forEach () at MsalInterceptor.matchResourcesToEndpoint (azure-msal-angular.js:422) at MsalInterceptor.getScopesForEndpoint (azure-msal-angular.js:404) at MsalInterceptor.intercept (azure-msal-angular.js:336) at HttpInterceptorHandler.handle (http.mjs:1415) at HttpXsrfInterceptor.intercept (http.mjs:2018) at HttpInterceptorHandler.handle (http.mjs:1415)

export function MSALInterceptorConfigFactory(): MsalInterceptorConfiguration {
  
 var fromDatetimeVariable ='2020-01-30';
 var toDatetimeVariable='2020-01-30';

  let queryUrl = `https://graph.microsoft.com/v1.0/communications/callRecords/getPstnCalls(fromDateTime=${fromDatetimeVariable},toDateTime=${toDatetimeVariable}`

  const protectedResourceMap = new Map<string, Array<string>>();
  protectedResourceMap.set(queryUrl, ['CallRecords.Read.All', 'CallRecord-PstnCalls.Read.All']);
  
 // protectedResourceMap.set('https://graph.microsoft.com/v1.0/me', ['CallRecord-PstnCalls.Read.All', 'mail.read']);
 // protectedResourceMap.set('http://localhost:8080/hello', ['api://d16e1a06-3be2-4ae1-8bd4-718c19cecac3/hello']);

  return {
    interactionType: InteractionType.Popup,
    protectedResourceMap
  };
}

CodePudding user response:

You have missed to close the parentheses in the queryUrl value. To correct this, your queryUrl value must be like:

let queryUrl = `https://graph.microsoft.com/v1.0/communications/callRecords/getPstnCalls(fromDateTime=${fromDatetimeVariable},toDateTime=${toDatetimeVariable})`
  • Related