1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-23 01:39:36 +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() { render() {
const {edition, currentUser, coaMeta} = this.state; const { edition, currentUser, coaMeta } = this.state;
if (edition && edition.id && currentUser && currentUser.email) { if (Object.keys(edition).length && edition.id && currentUser && currentUser.email) {
setDocumentTitle([edition.artist_name, edition.title].join(', ')); setDocumentTitle([edition.artist_name, edition.title].join(', '));
return ( return (
<Edition <Edition

View File

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