1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-22 17:33:14 +01:00

In EditionStore use empty object instead of null as default state

This commit is contained in:
Tim Daubenschütz 2015-12-09 13:21:55 +01:00
parent 2a251897d5
commit 057a278d19
2 changed files with 5 additions and 5 deletions

View File

@ -87,8 +87,8 @@ let EditionContainer = React.createClass({
},
render() {
const {edition, currentUser, coaMeta} = this.state;
if (edition && edition.id && currentUser && currentUser.email) {
const { edition, currentUser, coaMeta } = this.state;
if (Object.keys(edition).length && edition.id && currentUser && currentUser.email) {
setDocumentTitle([edition.artist_name, edition.title].join(', '));
return (
<Edition

View File

@ -10,7 +10,7 @@ import CoaSource from '../sources/coa_source';
class EditionStore {
constructor() {
this.edition = null;
this.edition = {};
this.editionMeta = {
err: null,
idToFetch: null
@ -47,7 +47,7 @@ class EditionStore {
}
onSuccessFetchCoa(res) {
if (res && res.coa && this.edition) {
if (res && res.coa && Object.keys(this.edition).length) {
this.edition.coa = res.coa;
this.coaMeta.err = null;
} else {
@ -56,7 +56,7 @@ class EditionStore {
}
onFlushEdition() {
this.edition = null;
this.edition = {};
this.editionMeta = {
err: null,
idToFetch: null