1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-23 01:39:36 +01:00
onion/js/sources/whitelabel_source.js

29 lines
740 B
JavaScript
Raw Normal View History

2015-11-04 11:36:42 +01:00
'use strict';
import requests from '../utils/requests';
import WhitelabelActions from '../actions/whitelabel_actions';
import { getSubdomain } from '../utils/general_utils';
const WhitelabelSource = {
lookupWhitelabel: {
remote() {
2016-02-05 10:38:59 +01:00
return requests.get('whitelabel_settings', { 'subdomain': getSubdomain() });
2015-11-04 11:36:42 +01:00
},
2016-02-05 10:38:59 +01:00
2015-11-04 11:36:42 +01:00
local(state) {
2016-02-05 10:38:59 +01:00
return Object.keys(state.whitelabel).length ? state : {};
2015-11-04 11:36:42 +01:00
},
2016-02-05 10:38:59 +01:00
2015-11-04 11:36:42 +01:00
success: WhitelabelActions.successFetchWhitelabel,
error: WhitelabelActions.errorWhitelabel,
2016-02-05 10:38:59 +01:00
shouldFetch(state, invalidateCache) {
return invalidateCache || !Object.keys(state.whitelabel).length;
2015-11-04 11:36:42 +01:00
}
}
};
2016-02-05 10:38:59 +01:00
export default WhitelabelSource;