mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-26 04:55:15 +00:00
Store autorefresh state
This commit is contained in:
parent
2bd0198697
commit
afeec39cd5
|
@ -4,7 +4,7 @@
|
|||
Refresh all
|
||||
</button>
|
||||
|
||||
<b-form-checkbox class="float-right" v-model="autoRefresh" size="lg" switch
|
||||
<b-form-checkbox class="float-right" v-model="autoRefreshLoc" size="lg" switch
|
||||
>AutoRefresh</b-form-checkbox
|
||||
>
|
||||
</div>
|
||||
|
@ -16,8 +16,6 @@ import { Action, State } from 'vuex-class';
|
|||
|
||||
@Component({})
|
||||
export default class ReloadControl extends Vue {
|
||||
autoRefresh = true;
|
||||
|
||||
refreshInterval: NodeJS.Timer | null = null;
|
||||
|
||||
refreshIntervalSlow: NodeJS.Timer | null = null;
|
||||
|
@ -39,6 +37,10 @@ export default class ReloadControl extends Vue {
|
|||
|
||||
@State loggedIn;
|
||||
|
||||
@State autoRefresh!: boolean;
|
||||
|
||||
@Action setAutoRefresh!: (newValue: boolean) => void;
|
||||
|
||||
@Action refreshSlow;
|
||||
|
||||
@Action refreshFrequent;
|
||||
|
@ -47,6 +49,14 @@ export default class ReloadControl extends Vue {
|
|||
|
||||
@Action refreshOnce;
|
||||
|
||||
get autoRefreshLoc() {
|
||||
return this.autoRefresh;
|
||||
}
|
||||
|
||||
set autoRefreshLoc(newValue: boolean) {
|
||||
this.setAutoRefresh(newValue);
|
||||
}
|
||||
|
||||
startRefresh() {
|
||||
if (this.loggedIn !== true) {
|
||||
console.log('Not logged in.');
|
||||
|
|
|
@ -5,12 +5,15 @@ import userService from '@/shared/userService';
|
|||
import ftbotModule from './modules/ftbot';
|
||||
import alertsModule from './modules/alerts';
|
||||
|
||||
const AUTO_REFRESH = 'ft_auto_refresh';
|
||||
|
||||
Vue.use(Vuex);
|
||||
|
||||
export default new Vuex.Store({
|
||||
state: {
|
||||
ping: '',
|
||||
loggedIn: userService.loggedIn(),
|
||||
autoRefresh: JSON.parse(localStorage.getItem(AUTO_REFRESH) || 'false'),
|
||||
},
|
||||
modules: {
|
||||
ftbot: ftbotModule,
|
||||
|
@ -25,8 +28,15 @@ export default new Vuex.Store({
|
|||
setLoggedIn(state, loggedin: boolean) {
|
||||
state.loggedIn = loggedin;
|
||||
},
|
||||
setAutoRefresh(state, newRefreshValue: boolean) {
|
||||
state.autoRefresh = newRefreshValue;
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
setAutoRefresh({ commit }, newRefreshValue) {
|
||||
commit('setAutoRefresh', newRefreshValue);
|
||||
localStorage.setItem(AUTO_REFRESH, JSON.stringify(newRefreshValue));
|
||||
},
|
||||
refreshOnce({ dispatch }) {
|
||||
dispatch('ftbot/getVersion');
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue
Block a user