mirror of
https://github.com/mempool/mempool.git
synced 2025-04-22 06:27:02 +02:00
Merge pull request #3608 from mempool/nymkappa/fix-default-graph-preference
Use window.location object instead of angular router for default graph window preference setting
This commit is contained in:
commit
61e29bcff9
@ -12,20 +12,22 @@ export class StorageService {
|
||||
|
||||
setDefaultValueIfNeeded(key: string, defaultValue: string) {
|
||||
const graphWindowPreference: string = this.getValue(key);
|
||||
const fragment = window.location.hash.replace('#', '');
|
||||
|
||||
if (graphWindowPreference === null) { // First visit to mempool.space
|
||||
if (this.router.url.includes('graphs') && key === 'graphWindowPreference' ||
|
||||
this.router.url.includes('pools') && key === 'miningWindowPreference'
|
||||
if (window.location.pathname.includes('graphs') && key === 'graphWindowPreference' ||
|
||||
window.location.pathname.includes('pools') && key === 'miningWindowPreference'
|
||||
) {
|
||||
this.setValue(key, this.route.snapshot.fragment ? this.route.snapshot.fragment : defaultValue);
|
||||
this.setValue(key, fragment ? fragment : defaultValue);
|
||||
} else {
|
||||
this.setValue(key, defaultValue);
|
||||
}
|
||||
} else if (this.router.url.includes('graphs') && key === 'graphWindowPreference' ||
|
||||
this.router.url.includes('pools') && key === 'miningWindowPreference'
|
||||
} else if (window.location.pathname.includes('graphs') && key === 'graphWindowPreference' ||
|
||||
window.location.pathname.includes('pools') && key === 'miningWindowPreference'
|
||||
) {
|
||||
// Visit a different graphs#fragment from last visit
|
||||
if (this.route.snapshot.fragment !== null && graphWindowPreference !== this.route.snapshot.fragment) {
|
||||
this.setValue(key, this.route.snapshot.fragment);
|
||||
if (fragment !== null && graphWindowPreference !== fragment) {
|
||||
this.setValue(key, fragment);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user