Skip to content
Snippets Groups Projects
Commit 33ec86c2 authored by Bhabesh Bhabani Mukhopadhyay's avatar Bhabesh Bhabani Mukhopadhyay
Browse files

Configure two way sync for observation

Login and Observation List configured with two way sync for observation
parent db4ccf45
Branches
No related tags found
No related merge requests found
......@@ -149,6 +149,7 @@ export default {
/** Calling of Sync */
//this.isSyncNeeded = true;
this.$refs.Sync.isSyncOnewayNeeded(loggedUser);
this.$refs.Sync.syncTwoWayAtLogin();
localStorage.setItem(CommonUtil.CONST_STORAGE_USER_DETAIL,JSON.stringify(loggedUser));
this.getUserFromStorage();
$('.offcanvas-collapse').removeClass('open');
......
......@@ -20,13 +20,16 @@
<p class="text-danger">You don't have any observations.</p>
</div>
<common-util ref="CommonUtil"/>
<sync ref="Sync" />
</div>
</template>
<script>
import CommonUtil from '@/components/CommonUtil'
import Sync from '@/components/Sync'
import { DateTime } from 'luxon'
export default {
name: "ObservationList",
data() {
......@@ -36,12 +39,12 @@ export default {
observations : undefined,
};
},
components : {CommonUtil},
components : {CommonUtil,Sync},
methods : {
/** TODO
* This function need to be shifted for two way sync process
*/
fetchFromServer()
/* fetchFromServer()
{
let strUUID = localStorage.getItem(CommonUtil.CONST_STORAGE_UUID);
let jsonHeader = { Authorization: strUUID };
......@@ -54,7 +57,7 @@ export default {
localStorage.setItem(CommonUtil.CONST_STORAGE_OBSERVATION_LIST,JSON.stringify(data));
this.getObservationsFromStore();
})
},
}, */
getObservationsFromStore()
{
let strObservations = localStorage.getItem(CommonUtil.CONST_STORAGE_OBSERVATION_LIST);
......@@ -71,6 +74,8 @@ export default {
}
},
mounted() {
let valueObj = {"name":CommonUtil.CONST_STORAGE_OBSERVATION_LIST,"complete":false};
this.$refs.Sync.syncObservationSendPrepare(valueObj);
this.CONST_URL_DOMAIN = this.$refs.CommonUtil.getDomain();
let strUUID = localStorage.getItem(CommonUtil.CONST_STORAGE_UUID);
if(strUUID)
......
......@@ -536,7 +536,7 @@ export default {
if(this.counterTwoWaySyncPOST === totalTwoWaySyncPOST)
{
this.counterTwoWaySyncPOST = 0;
getObservationsFromServerTwowaySync(totalTwoWaySyncPOST,updatedObservation);
this.getObservationsFromServerTwowaySync(totalTwoWaySyncPOST,updatedObservation);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment