Fix typescript strict issues for CosmosClient and other files
This commit is contained in:
parent
8eeda41021
commit
12503fa140
|
@ -39,8 +39,16 @@ export const tokenProvider = async (requestInfo: RequestInfo) => {
|
|||
};
|
||||
|
||||
export const requestPlugin: Cosmos.Plugin<any> = async (requestContext, next) => {
|
||||
requestContext.endpoint = new URL(configContext.PROXY_PATH, window.location.href).href;
|
||||
requestContext.headers["x-ms-proxy-target"] = endpoint();
|
||||
requestContext.endpoint = new URL(
|
||||
configContext.PROXY_PATH ? configContext.PROXY_PATH : "",
|
||||
window.location.href
|
||||
).href;
|
||||
if (requestContext.headers !== undefined) {
|
||||
const returnValue = endpoint();
|
||||
if (returnValue !== undefined) {
|
||||
requestContext.headers["x-ms-proxy-target"] = returnValue;
|
||||
}
|
||||
}
|
||||
return next(requestContext);
|
||||
};
|
||||
|
||||
|
@ -60,7 +68,7 @@ export async function getTokenFromAuthService(verb: string, resourceType: string
|
|||
method: "POST",
|
||||
headers: {
|
||||
"content-type": "application/json",
|
||||
"x-ms-encrypted-auth-token": userContext.accessToken,
|
||||
"x-ms-encrypted-auth-token": userContext.accessToken ? userContext.accessToken : "",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
verb,
|
||||
|
|
|
@ -28,10 +28,10 @@ export const getErrorMessage = (error: string | Error = ""): string => {
|
|||
};
|
||||
|
||||
export const getErrorStack = (error: string | Error): string => {
|
||||
return typeof error === "string" ? undefined : error.stack;
|
||||
return typeof error === "string" ? "" : error.stack === undefined ? "" : error.stack;
|
||||
};
|
||||
|
||||
const sendNotificationForError = (errorMessage: string, errorCode: number | string): void => {
|
||||
const sendNotificationForError = (errorMessage: string, errorCode: number | string | undefined): void => {
|
||||
if (errorCode === HttpStatusCodes.Forbidden) {
|
||||
if (errorMessage?.toLowerCase().indexOf("sharedoffer is disabled for your account") > 0) {
|
||||
return;
|
||||
|
|
|
@ -139,7 +139,8 @@
|
|||
"./src/userContext.test.ts",
|
||||
"src/Common/EntityValue.tsx",
|
||||
"./src/Platform/Hosted/Components/SwitchAccount.tsx",
|
||||
"./src/Platform/Hosted/Components/SwitchSubscription.tsx"
|
||||
"./src/Platform/Hosted/Components/SwitchSubscription.tsx",
|
||||
"./src/Common/CosmosClient.ts"
|
||||
],
|
||||
"include": [
|
||||
"src/CellOutputViewer/transforms/**/*",
|
||||
|
|
Loading…
Reference in New Issue