mirror of
https://github.com/ascribe/onion.git
synced 2025-01-03 10:25:08 +01:00
Fix invalidateCache functionality
This commit is contained in:
parent
ecdcbbc25e
commit
c17685731a
@ -18,7 +18,7 @@ const UserSource = {
|
|||||||
success: UserActions.successFetchCurrentUser,
|
success: UserActions.successFetchCurrentUser,
|
||||||
error: UserActions.currentUserFailed,
|
error: UserActions.currentUserFailed,
|
||||||
shouldFetch(state) {
|
shouldFetch(state) {
|
||||||
return state.invalidateCache || state.currentUser && !state.currentUser.email;
|
return state.userMeta.invalidateCache || state.currentUser && !state.currentUser.email;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
25
js/sources/whitelabel_source.js
Normal file
25
js/sources/whitelabel_source.js
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
'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;
|
Loading…
Reference in New Issue
Block a user