Prettier 2.0 (#393)

This commit is contained in:
Steve Faulkner
2021-01-20 09:15:01 -06:00
committed by GitHub
parent c1937ca464
commit 4be53284b5
500 changed files with 41927 additions and 41838 deletions

View File

@@ -4,12 +4,12 @@ import { UserAgentApplication, Account, Configuration } from "msal";
const config: Configuration = {
cache: {
cacheLocation: "localStorage"
cacheLocation: "localStorage",
},
auth: {
authority: "https://login.microsoftonline.com/common",
clientId: "203f1145-856a-4232-83d4-a43568fba23d"
}
clientId: "203f1145-856a-4232-83d4-a43568fba23d",
},
};
if (process.env.NODE_ENV === "development") {
@@ -56,9 +56,9 @@ export function useAADAuth(): ReturnType {
}, []);
const switchTenant = React.useCallback(
async id => {
async (id) => {
const response = await msal.loginPopup({
authority: `https://login.microsoftonline.com/${id}`
authority: `https://login.microsoftonline.com/${id}`,
});
setTenantId(response.tenantId);
setAccount(response.account);
@@ -73,14 +73,14 @@ export function useAADAuth(): ReturnType {
// There is a bug in MSALv1 that requires us to refresh the token. Their internal cache is not respecting authority
forceRefresh: true,
authority: `https://login.microsoftonline.com/${tenantId}`,
scopes: ["https://graph.windows.net//.default"]
scopes: ["https://graph.windows.net//.default"],
}),
msal.acquireTokenSilent({
// There is a bug in MSALv1 that requires us to refresh the token. Their internal cache is not respecting authority
forceRefresh: true,
authority: `https://login.microsoftonline.com/${tenantId}`,
scopes: ["https://management.azure.com//.default"]
})
scopes: ["https://management.azure.com//.default"],
}),
]).then(([graphTokenResponse, armTokenResponse]) => {
setGraphToken(graphTokenResponse.accessToken);
setArmToken(armTokenResponse.accessToken);
@@ -96,6 +96,6 @@ export function useAADAuth(): ReturnType {
armToken,
login,
logout,
switchTenant
switchTenant,
};
}

View File

@@ -33,7 +33,7 @@ export function useDirectories(armToken: string): Tenant[] {
useEffect(() => {
if (armToken) {
fetchDirectories(armToken).then(response => setState(response));
fetchDirectories(armToken).then((response) => setState(response));
}
}, [armToken]);
return state || [];

View File

@@ -9,10 +9,10 @@ export async function fetchPhoto(accessToken: string): Promise<Blob | void> {
const options = {
method: "GET",
headers: headers
headers: headers,
};
return fetch("https://graph.windows.net/me/thumbnailPhoto?api-version=1.6", options).then(response =>
return fetch("https://graph.windows.net/me/thumbnailPhoto?api-version=1.6", options).then((response) =>
response.blob()
);
}
@@ -22,7 +22,7 @@ export function useGraphPhoto(graphToken: string): string {
useEffect(() => {
if (graphToken) {
fetchPhoto(graphToken).then(response => setPhoto(URL.createObjectURL(response)));
fetchPhoto(graphToken).then((response) => setPhoto(URL.createObjectURL(response)));
}
}, [graphToken]);
return photo;

View File

@@ -12,15 +12,15 @@ export async function fetchAccessData(portalToken: string): Promise<AccessInputM
const options = {
method: "GET",
headers: headers
headers: headers,
};
return (
fetch(url, options)
.then(response => response.json())
.then((response) => response.json())
// Portal encrypted token API quirk: The response is double JSON encoded
.then(json => JSON.parse(json))
.catch(error => console.error(error))
.then((json) => JSON.parse(json))
.catch((error) => console.error(error))
);
}
@@ -29,7 +29,7 @@ export function useTokenMetadata(token: string): AccessInputMetadata {
useEffect(() => {
if (token) {
fetchAccessData(token).then(response => setState(response));
fetchAccessData(token).then((response) => setState(response));
}
}, [token]);
return state;

View File

@@ -24,7 +24,7 @@ export async function fetchSubscriptions(accessToken: string): Promise<Subscript
}
nextLink = result.nextLink;
const validSubscriptions = result.value.filter(
sub => sub.state === "Enabled" || sub.state === "Warned" || sub.state === "PastDue"
(sub) => sub.state === "Enabled" || sub.state === "Warned" || sub.state === "PastDue"
);
subscriptions = [...subscriptions, ...validSubscriptions];
}