1
0
mirror of https://github.com/ascribe/onion.git synced 2024-06-30 13:41:57 +02:00
onion/js/stores/whitelabel_store.js
2015-11-03 10:07:44 +01:00

40 lines
1003 B
JavaScript

'use strict';
import { altWhitelabel } from '../alt';
import WhitelabelActions from '../actions/whitelabel_actions';
import WhitelabelSource from '../sources/whitelabel_source';
class WhitelabelStore {
constructor() {
this.whitelabel = {};
this.whitelabelMeta = {
invalidateCache: false,
err: null
};
this.bindActions(WhitelabelActions);
this.registerAsync(WhitelabelSource);
}
onFetchWhitelabel(invalidateCache) {
this.whitelabelMeta.invalidateCache = invalidateCache;
if(!this.getInstance().isLoading()) {
this.getInstance().lookupWhitelabel();
}
}
onSuccessFetchWhitelabel(whitelabel) {
this.whitelabelMeta.invalidateCache = false;
this.whitelabel = whitelabel;
}
onWhitelabelFailed(err) {
console.logGlobal(err);
this.whitelabelMeta.err = err;
}
}
export default altWhitelabel.createStore(WhitelabelStore, 'WhitelabelStore');