mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-10 10:21:55 +00:00
Use /ping to verify online status
This commit is contained in:
parent
9edf2e9e02
commit
6f54864295
|
@ -43,20 +43,37 @@
|
|||
<script lang="ts">
|
||||
import { Component, Vue } from 'vue-property-decorator';
|
||||
import LoginModal from '@/views/LoginModal.vue';
|
||||
import { State, Mutation } from 'vuex-class';
|
||||
import { State, Mutation, Action, namespace } from 'vuex-class';
|
||||
import userService from '@/shared/userService';
|
||||
import BootswatchThemeSelect from '@/components/BootswatchThemeSelect.vue';
|
||||
|
||||
const ftbot = namespace('ftbot');
|
||||
|
||||
@Component({
|
||||
components: { LoginModal, BootswatchThemeSelect },
|
||||
})
|
||||
export default class NavBar extends Vue {
|
||||
pingInterval: NodeJS.Timer | null = null;
|
||||
|
||||
@State loggedIn!: boolean;
|
||||
|
||||
@State isBotOnline!: boolean;
|
||||
|
||||
@Mutation setLoggedIn;
|
||||
|
||||
@ftbot.Action ping;
|
||||
|
||||
mounted() {
|
||||
this.ping();
|
||||
this.pingInterval = setInterval(this.ping, 60000);
|
||||
}
|
||||
|
||||
beforeDestroy() {
|
||||
if (this.pingInterval) {
|
||||
clearInterval(this.pingInterval);
|
||||
}
|
||||
}
|
||||
|
||||
logout(): void {
|
||||
userService.logout();
|
||||
this.setLoggedIn(false);
|
||||
|
|
|
@ -71,7 +71,10 @@ export default {
|
|||
ping({ commit }) {
|
||||
api
|
||||
.get('/ping')
|
||||
.then((result) => commit('setPing', result.data))
|
||||
.then((result) => {
|
||||
commit('setPing', result.data, { root: true });
|
||||
commit('setIsBotOnline', result.data, { root: true });
|
||||
})
|
||||
.catch(console.error);
|
||||
},
|
||||
getTrades({ commit }) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user