1
0
mirror of https://github.com/ascribe/onion.git synced 2024-11-15 09:35:10 +01:00
onion/js/stores/whitelabel_store.js

41 lines
1.0 KiB
JavaScript
Raw Normal View History

2015-06-29 15:58:47 +02:00
'use strict';
import { altWhitelabel } from '../alt';
2015-06-29 15:58:47 +02:00
import WhitelabelActions from '../actions/whitelabel_actions';
import WhitelabelSource from '../sources/whitelabel_source';
2015-06-29 15:58:47 +02:00
class WhitelabelStore {
constructor() {
this.whitelabel = {};
this.whitelabelMeta = {
invalidateCache: false,
err: null
};
2015-06-29 15:58:47 +02:00
this.bindActions(WhitelabelActions);
this.registerAsync(WhitelabelSource);
}
onFetchWhitelabel(invalidateCache) {
this.whitelabelMeta.invalidateCache = invalidateCache;
if(!this.getInstance().isLoading()) {
this.getInstance().lookupWhitelabel();
}
2015-06-29 15:58:47 +02:00
}
2015-11-03 10:09:44 +01:00
onSuccessFetchWhitelabel({ whitelabel }) {
this.whitelabelMeta.invalidateCache = false;
2015-11-16 17:44:56 +01:00
this.whitelabelMeta.err = null;
2015-06-29 15:58:47 +02:00
this.whitelabel = whitelabel;
}
onErrorCurrentUser(err) {
console.logGlobal(err);
this.whitelabelMeta.err = err;
}
2015-06-29 15:58:47 +02:00
}
export default altWhitelabel.createStore(WhitelabelStore, 'WhitelabelStore');