Skip to content

Commit

Permalink
Merge pull request #514 from gautamdsheth/filePickerFixes
Browse files Browse the repository at this point in the history
Fix: additional check for OrgAssets HTTP request
  • Loading branch information
AJIXuMuK authored Mar 27, 2020
2 parents e1c2dc8 + cc4752c commit b491e9a
Showing 1 changed file with 10 additions and 7 deletions.
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

0 comments on commit b491e9a

Please sign in to comment.