Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: additional check for OrgAssets HTTP request #514

Merged
merged 1 commit into from
Mar 27, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions src/controls/filePicker/FilePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import { IFilePickerProps } from './IFilePickerProps';
import { IFilePickerState } from './IFilePickerState';

import { PrimaryButton, ActionButton } from 'office-ui-fabric-react/lib/components/Button';
import { PrimaryButton, ActionButton } from 'office-ui-fabric-react/lib/components/Button';
import { Panel, PanelType } from 'office-ui-fabric-react/lib/components/Panel';
import { Label } from 'office-ui-fabric-react/lib/components/Label';
import { Nav, INavLink, INavLinkGroup } from 'office-ui-fabric-react/lib/Nav';
Expand Down Expand Up @@ -54,19 +54,22 @@ export class FilePicker extends React.Component<IFilePickerProps, IFilePickerSta

public async componentDidMount() {
// Load information about Organisation Assets Library
const orgAssetsLibraries = await this.orgAssetsService.getSiteMediaLibraries();
const organisationAssetsEnabled = orgAssetsLibraries ? true : false;
let orgAssetsEnabled: boolean = false;
if (this.props.hideOrganisationalAssetTab != undefined && !this.props.hideOrganisationalAssetTab) {
const orgAssetsLibraries = await this.orgAssetsService.getSiteMediaLibraries();
orgAssetsEnabled = orgAssetsLibraries ? true : false;
}

this.setState({
organisationAssetsEnabled
organisationAssetsEnabled: orgAssetsEnabled
});
}

public render(): JSX.Element {
// If no acceptable file type was passed, and we're expecting images, set the default image filter
const accepts: string[] = this.props.accepts;
const buttonClassName :string = this.props.buttonClassName ? this.props.buttonClassName : '';
const panelClassName :string = this.props.panelClassName ? this.props.panelClassName : '';
const buttonClassName: string = this.props.buttonClassName ? this.props.buttonClassName : '';
const panelClassName: string = this.props.panelClassName ? this.props.panelClassName : '';

const linkTabProps = {
accepts: accepts,
Expand Down Expand Up @@ -281,7 +284,7 @@ export class FilePicker extends React.Component<IFilePickerProps, IFilePickerSta
});
}

let groups: INavLinkGroup[] = [ { links} ];
let groups: INavLinkGroup[] = [{ links }];
return groups;
}

Expand Down