语法错误无效的正则表达式 angular 打字稿

Syntax error Invalid Regular expression angular typescript

我遇到了这个错误,我无法找到语法问题在哪里

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
  };
}

您没有关闭 queryUrl 值中的括号。要更正此问题,您的 queryUrl 值必须类似于:

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