mirror of
https://github.com/ascribe/onion.git
synced 2024-06-30 21:52:08 +02:00
25 lines
748 B
JavaScript
25 lines
748 B
JavaScript
|
'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,
|
||
|
error: WhitelabelActions.whitelabelFailed,
|
||
|
shouldFetch(state) {
|
||
|
return state.whitelabelMeta.invalidateCache || Object.keys(state.whitelabel).length === 0;
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
|
||
|
export default WhitelabelSource;
|