diff --git a/src/app/views/App.tsx b/src/app/views/App.tsx index 81bec13b0..0ea920d33 100644 --- a/src/app/views/App.tsx +++ b/src/app/views/App.tsx @@ -18,7 +18,7 @@ import { clearQueryStatus } from '../services/actions/query-status-action-creato import { clearTermsOfUse } from '../services/actions/terms-of-use-action-creator'; import { changeThemeSuccess } from '../services/actions/theme-action-creator'; import { toggleSidebar } from '../services/actions/toggle-sidebar-action-creator'; -import { getLoginType, logIn } from '../services/graph-client/msal-service'; +import { logIn } from '../services/graph-client/msal-service'; import { parseSampleUrl } from '../utils/sample-url-generation'; import { substituteTokens } from '../utils/token-helpers'; import { appTitleDisplayOnFullScreen, appTitleDisplayOnMobileScreen } from './app-sections/AppTitle'; @@ -155,7 +155,7 @@ class App extends Component { selectedVerb: method, selectedVersion: version, sampleBody: this.hashDecode(requestBody), - sampleHeaders: JSON.parse(this.hashDecode(headers)), + sampleHeaders: (headers) ? JSON.parse(this.hashDecode(headers)) : [], }; } @@ -246,25 +246,6 @@ class App extends Component { }); }; - public promptNewLogin = async () => { - this.closeDialog(); - localStorage.clear(); - const { mscc } = (window as any); - - if (mscc) { - mscc.setConsent(); - } - - setTimeout(async () => { - const authResponse = await logIn(); - if (authResponse) { - this.props.actions!.signIn(authResponse.accessToken); - this.props.actions!.storeScopes(authResponse.scopes); - } - }, 700); - - } - public toggleSidebar = (): void => { const { sidebarProperties } = this.props; const properties = { ...sidebarProperties }; @@ -324,7 +305,6 @@ class App extends Component { const historyHeaderText = messages['History']; const { mobileScreen, showSidebar } = sidebarProperties; const language = navigator.language || 'en-US'; - const loginType = getLoginType(); let displayContent = true; if (graphExplorerMode === Mode.Complete) { @@ -391,7 +371,7 @@ class App extends Component { )}
- {graphExplorerMode.TryIt && headerMessaging(loginType, classes, query)} + {graphExplorerMode === Mode.TryIt && headerMessaging(classes, query)} {displayContent && <>
diff --git a/src/app/views/app-sections/HeaderMessaging.tsx b/src/app/views/app-sections/HeaderMessaging.tsx index ce2709ed2..789f04282 100644 --- a/src/app/views/app-sections/HeaderMessaging.tsx +++ b/src/app/views/app-sections/HeaderMessaging.tsx @@ -1,9 +1,14 @@ import { MessageBar, MessageBarType } from 'office-ui-fabric-react'; import React from 'react'; import { FormattedMessage } from 'react-intl'; + import { LoginType } from '../../../types/enums'; +import { getLoginType } from '../../services/graph-client/msal-service'; import { Authentication } from '../authentication'; -export function headerMessaging(loginType: LoginType, classes: any, query: string): React.ReactNode { + +export function headerMessaging(classes: any, query: string): React.ReactNode { + const loginType = getLoginType(); + return (
{loginType === LoginType.Popup && <> diff --git a/src/app/views/common/share.ts b/src/app/views/common/share.ts index c27783e3b..b77f73a39 100644 --- a/src/app/views/common/share.ts +++ b/src/app/views/common/share.ts @@ -30,7 +30,7 @@ export const createShareLink = (sampleQuery: IQuery, authenticated?: boolean): s // tslint:disable-next-line:max-line-length `${appUrl}?request=${graphUrlRequest}&method=${selectedVerb}&version=${queryVersion}&GraphUrl=${graphUrl}&requestBody=${requestBody}`; - if (sampleHeaders.length > 0) { + if (sampleHeaders && sampleHeaders.length > 0) { const headers = hashEncode(JSON.stringify(sampleHeaders)); shareLink = `${shareLink}&headers=${headers}`; }