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() {
|
|
|
|
return requests.get('whitelabel_settings', {'subdomain': getSubdomain()});
|
|
|
|
},
|
|
|
|
local(state) {
|
|
|
|
return Object.keys(state.whitelabel).length > 0 ? state : {};
|
|
|
|
},
|
|
|
|
success: WhitelabelActions.successFetchWhitelabel,
|
2015-11-16 17:16:13 +01:00
|
|
|
error: WhitelabelActions.errorWhitelabel,
|
2015-11-04 11:36:42 +01:00
|
|
|
shouldFetch(state) {
|
|
|
|
return state.whitelabelMeta.invalidateCache || Object.keys(state.whitelabel).length === 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
export default WhitelabelSource;
|