mirror of
https://github.com/ascribe/onion.git
synced 2024-12-23 09:50:31 +01:00
29 lines
744 B
JavaScript
29 lines
744 B
JavaScript
'use strict';
|
|
|
|
import requests from '../utils/requests';
|
|
import WhitelabelActions from '../actions/whitelabel_actions';
|
|
|
|
import { getCurrentSubdomain } from '../utils/url';
|
|
|
|
|
|
const WhitelabelSource = {
|
|
lookupWhitelabel: {
|
|
remote() {
|
|
return requests.get('whitelabel_settings', { 'subdomain': getCurrentSubdomain() });
|
|
},
|
|
|
|
local(state) {
|
|
return Object.keys(state.whitelabel).length ? state : {};
|
|
},
|
|
|
|
success: WhitelabelActions.successFetchWhitelabel,
|
|
error: WhitelabelActions.errorWhitelabel,
|
|
|
|
shouldFetch(state, invalidateCache) {
|
|
return invalidateCache || !Object.keys(state.whitelabel).length;
|
|
}
|
|
}
|
|
};
|
|
|
|
export default WhitelabelSource;
|