Skip to content

Commit

Permalink
Change server detection method
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubkottnauer committed Sep 18, 2016
1 parent 0452943 commit 7d537fb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "redux-file-upload",
"version": "0.0.13",
"version": "0.0.15",
"description": "Redux-friendly file upload made easy",
"main": "lib/index.js",
"author": "Blueberry",
Expand Down Expand Up @@ -56,6 +56,7 @@
"dependencies": {
"bluebird": ">=3",
"core-decorators": ">=0.12",
"detect-node": "^2.0.3",
"fileapi": "^2.0.21",
"immutable": ">=3",
"radium": ">=0.15",
Expand Down
5 changes: 3 additions & 2 deletions src/FileUpload.react.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import * as actions from './actions';
import autobind from 'core-decorators/lib/autobind';
import Component from 'react-pure-render/component';
import isServer from 'detect-node';
import Promise from 'bluebird';
import Radium from 'radium';
import React, { PropTypes as RPT } from 'react';
import { connect } from 'react-redux';
import { filterAllowedFiles, filterDocFiles, filterImageFiles } from './helpers';

const FileAPI = process.env.IS_BROWSER ? Promise.promisifyAll(require('fileapi')) : null;
const FileAPI = !isServer ? Promise.promisifyAll(require('fileapi')) : null;

@connect(null, actions)
@Radium
Expand Down Expand Up @@ -81,8 +82,8 @@ export default class FileUpload extends Component {
allowedFileTypes,
data,
dropzoneId,
uploadFiles,
identifier,
uploadFiles,
url
} = this.props;

Expand Down
3 changes: 2 additions & 1 deletion src/actions.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import isServer from 'detect-node';
import Promise from 'bluebird';
import { isDoc, isImage } from './helpers';

const FileAPI = process.env.IS_BROWSER ? require('fileapi') : null;
const FileAPI = !isServer ? require('fileapi') : null;

export const THUMBNAIL_WIDTH = 200;
export const THUMBNAIL_HEIGHT = 200;
Expand Down

0 comments on commit 7d537fb

Please sign in to comment.