Skip to content

Commit

Permalink
Web extension ECS call
Browse files Browse the repository at this point in the history
  • Loading branch information
tyaginidhi committed Nov 3, 2023
1 parent 27fa9f0 commit 045ef29
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion src/web/client/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
showErrorDialog,
} from "./common/errorHandler";
import { WebExtensionTelemetry } from "./telemetry/webExtensionTelemetry";
import { isCoPresenceEnabled, updateFileContentInFileDataMap } from "./utilities/commonUtil";
import { getEnvironmentIdFromUrl, isCoPresenceEnabled, updateFileContentInFileDataMap } from "./utilities/commonUtil";
import { NPSService } from "./services/NPSService";
import { vscodeExtAppInsightsResourceProvider } from "../../common/telemetry-generated/telemetryConfiguration";
import { NPSWebView } from "./webViews/NPSWebView";
Expand Down Expand Up @@ -144,6 +144,8 @@ export function activate(context: vscode.ExtensionContext): void {
context.extensionUri
);
}

await fetchECSConfig();
}
break;
default:
Expand Down Expand Up @@ -190,6 +192,31 @@ export function activate(context: vscode.ExtensionContext): void {
showWalkthrough(context, WebExtensionContext.telemetry);
}



export async function fetchECSConfig() {
const requestURL = `https://ecs.office.com/config/v1/PortalsMakerExperiences/1.0.0.0?EnvironmentID=${getEnvironmentIdFromUrl()}&AppName=powerpages-microsoft-com&UserID=${WebExtensionContext.userId}&TenantID=${WebExtensionContext.urlParametersMap?.get(
queryParameters.TENANT_ID
)}`;

const requestInit: RequestInit = {
method: 'GET'
};

try {
const response = await fetch(requestURL, requestInit);
if (!response.ok) {
throw new Error('Request failed');
}
const result = await response.json();
console.log(result);
return result;
} catch (error) {
return null;
}

}

export function powerPagesNavigation() {
const powerPagesNavigationProvider = new PowerPagesNavigationProvider();
vscode.window.registerTreeDataProvider('powerpages.powerPagesFileExplorer', powerPagesNavigationProvider);
Expand Down

0 comments on commit 045ef29

Please sign in to comment.