persist subscriptions
This commit is contained in:
parent
f670fda6c2
commit
f7d975b7bb
3 changed files with 26 additions and 10 deletions
|
@ -33,7 +33,7 @@ class FilePrice extends React.PureComponent<Props> {
|
||||||
const { costInfo, fetchCostInfo, uri, fetching, claim } = props;
|
const { costInfo, fetchCostInfo, uri, fetching, claim } = props;
|
||||||
|
|
||||||
if (costInfo === undefined && !fetching && claim) {
|
if (costInfo === undefined && !fetching && claim) {
|
||||||
fetchCostInfo(uri);
|
// fetchCostInfo(uri);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ ipcRenderer.on('navigate-forward', () => {
|
||||||
// @endif
|
// @endif
|
||||||
|
|
||||||
// @if TARGET='web'
|
// @if TARGET='web'
|
||||||
const SDK_API_URL = process.env.SDK_API_URL || 'https://api.lbry.tv/api/proxy';
|
const SDK_API_URL = process.env.SDK_API_URL || 'https://api.piratebay.com/api/proxy';
|
||||||
Lbry.setDaemonConnectionString(SDK_API_URL);
|
Lbry.setDaemonConnectionString(SDK_API_URL);
|
||||||
// @endif
|
// @endif
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ Lbryio.setOverride(
|
||||||
const newAuthToken = response.auth_token;
|
const newAuthToken = response.auth_token;
|
||||||
authToken = newAuthToken;
|
authToken = newAuthToken;
|
||||||
// @if TARGET='web'
|
// @if TARGET='web'
|
||||||
document.cookie = cookie.serialize('authToken', authToken);
|
document.cookie = cookie.serialize('auth_token', authToken);
|
||||||
// @endif
|
// @endif
|
||||||
// @if TARGET='app'
|
// @if TARGET='app'
|
||||||
ipcRenderer.send('set-auth-token', authToken);
|
ipcRenderer.send('set-auth-token', authToken);
|
||||||
|
@ -115,7 +115,7 @@ Lbryio.setOverride(
|
||||||
ipcRenderer.send('get-auth-token');
|
ipcRenderer.send('get-auth-token');
|
||||||
// @endif
|
// @endif
|
||||||
// @if TARGET='web'
|
// @if TARGET='web'
|
||||||
const { authToken } = cookie.parse(document.cookie);
|
const { auth_token: authToken } = cookie.parse(document.cookie);
|
||||||
resolve(authToken);
|
resolve(authToken);
|
||||||
// @endif
|
// @endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,21 +74,37 @@ const walletFilter = createFilter('wallet', ['receiveAddress']);
|
||||||
const searchFilter = createFilter('search', ['options']);
|
const searchFilter = createFilter('search', ['options']);
|
||||||
|
|
||||||
const persistOptions = {
|
const persistOptions = {
|
||||||
whitelist: ['subscriptions', 'publish', 'wallet', 'content', 'fileInfo', 'app', 'search'],
|
whitelist: [
|
||||||
|
// @if TARGET='app'
|
||||||
|
'publish',
|
||||||
|
'wallet',
|
||||||
|
'fileInfo',
|
||||||
|
// @endif
|
||||||
|
'content',
|
||||||
|
'subscriptions',
|
||||||
|
'app',
|
||||||
|
'search',
|
||||||
|
],
|
||||||
// Order is important. Needs to be compressed last or other transforms can't
|
// Order is important. Needs to be compressed last or other transforms can't
|
||||||
// read the data
|
// read the data
|
||||||
transforms: [walletFilter, contentFilter, fileInfoFilter, appFilter, searchFilter, compressor],
|
transforms: [
|
||||||
debounce: 10000,
|
// @if TARGET='app'
|
||||||
|
walletFilter,
|
||||||
|
contentFilter,
|
||||||
|
fileInfoFilter,
|
||||||
|
// @endif
|
||||||
|
appFilter,
|
||||||
|
searchFilter,
|
||||||
|
compressor,
|
||||||
|
],
|
||||||
|
debounce: IS_WEB ? 5000 : 10000,
|
||||||
storage: localForage,
|
storage: localForage,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Dont' persist anything on web (for now)
|
|
||||||
// @if TARGET='app'
|
|
||||||
window.cacheStore = persistStore(store, persistOptions, err => {
|
window.cacheStore = persistStore(store, persistOptions, err => {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error('Unable to load saved settings');
|
console.error('Unable to load saved settings');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// @endif
|
|
||||||
|
|
||||||
export { store, history };
|
export { store, history };
|
||||||
|
|
Loading…
Add table
Reference in a new issue