fix: ask updated dbLoadTodo (if something to process) only when is connected...

This commit is contained in:
Paolo Arena
2019-02-15 14:54:56 +01:00
parent fac16d2d52
commit ffe3fce52b
4 changed files with 14 additions and 10 deletions

View File

@@ -1,8 +1,5 @@
<template> <template>
<div :class="getClassRow()"> <div :class="getClassRow()">
<q-context-menu ref="contextMenu">
<SubMenus :menuPopupTodo="menuPopupTodo" :itemtodo="itemtodo" @clickMenu="clickMenu" @setPriority="setPriority"></SubMenus>
</q-context-menu>
<div v-if="isTodo()" class="flex-item completed-item"> <div v-if="isTodo()" class="flex-item completed-item">
@@ -53,9 +50,9 @@
<q-btn push <q-btn push
:class="clButtPopover" :class="clButtPopover"
icon="menu" > icon="menu" >
<q-popover self="top right"> <!--<q-popover self="top right">-->
<SubMenus :menuPopupTodo="menuPopupTodo" :itemtodo="itemtodo" @clickMenu="clickMenu" @setPriority="setPriority"></SubMenus> <!--<SubMenus :menuPopupTodo="menuPopupTodo" :itemtodo="itemtodo" @clickMenu="clickMenu" @setPriority="setPriority"></SubMenus>-->
</q-popover> <!--</q-popover>-->
</q-btn> </q-btn>
</div> </div>

View File

@@ -12,7 +12,7 @@
<div class="drag"> <div class="drag">
<draggable v-model="todos_arr" :options="{draggable:'.myitemdrag'}" <draggable v-model="todos_arr" :options="{draggable:'.myitemdrag'}"
@start="onStart" @end="onEnd" class="dragArea"> @start="onStart" @end="onEnd" class="dragArea">
<transition-group :name="mytypetransgroup"> <!--<transition-group :name="mytypetransgroup">-->
<div :id="getmyid(mytodo._id)" :key="mytodo._id" v-for="mytodo in todos_arr" class="myitemdrag"> <div :id="getmyid(mytodo._id)" :key="mytodo._id" v-for="mytodo in todos_arr" class="myitemdrag">
<div v-if="(prior !== mytodo.priority) && !mytodo.completed" :class="getTitlePriority(mytodo.priority)"> <div v-if="(prior !== mytodo.priority) && !mytodo.completed" :class="getTitlePriority(mytodo.priority)">
@@ -28,9 +28,13 @@
<div style="display: none">{{ prior = mytodo.priority, priorcomplet = mytodo.completed }}</div> <div style="display: none">{{ prior = mytodo.priority, priorcomplet = mytodo.completed }}</div>
</div> </div>
</transition-group> <!--</transition-group>-->
</draggable> </draggable>
</div> </div>
<q-context-menu ref="contextMenu">
<SubMenus :menuPopupTodo="menuPopupTodo" :itemtodo="itemtodo" @clickMenu="clickMenu" @setPriority="setPriority"></SubMenus>
</q-context-menu>
<q-input ref="insertTask" v-model="todo" inverted :float-label="$t('todo.insert')" <q-input ref="insertTask" v-model="todo" inverted :float-label="$t('todo.insert')"
:after="[{icon: 'arrow_forward', content: true, handler () {}}]" :after="[{icon: 'arrow_forward', content: true, handler () {}}]"
v-on:keyup.enter="insertTodo"/> v-on:keyup.enter="insertTodo"/>

View File

@@ -128,7 +128,6 @@ namespace Actions {
let promiseChain = Promise.resolve() let promiseChain = Promise.resolve()
something = true
for (let rec of arr_recmsg) { for (let rec of arr_recmsg) {
// console.log(' .... sw.sync.register ( ', rec._id) // console.log(' .... sw.sync.register ( ', rec._id)
// if ('SyncManager' in window) { // if ('SyncManager' in window) {
@@ -138,6 +137,9 @@ namespace Actions {
// #Alternative to SyncManager // #Alternative to SyncManager
promiseChain = promiseChain.then(() => { promiseChain = promiseChain.then(() => {
return Api.syncAlternative(rec._id) return Api.syncAlternative(rec._id)
.then(() => {
something = true
})
}) })
// } // }
@@ -166,6 +168,7 @@ namespace Actions {
return sendSwMsgIfAvailable() return sendSwMsgIfAvailable()
.then(something => { .then(something => {
if (something) { if (something) {
console.log('something')
// Refresh data // Refresh data
return waitAndRefreshData(context) return waitAndRefreshData(context)
} }

View File

@@ -399,7 +399,7 @@ namespace Actions {
Mutations.mutations.setServerCode(rescodes.CALLING) Mutations.mutations.setServerCode(rescodes.CALLING)
let myres: IResult let myres: any
return Api.SendReq(call, 'POST', usertosend, true) return Api.SendReq(call, 'POST', usertosend, true)
.then(({ res, body }) => { .then(({ res, body }) => {