diff --git a/changelogs/unreleased/-1x68xu9.yml b/changelogs/unreleased/-1x68xu9.yml new file mode 100644 index 000000000..605175e6e --- /dev/null +++ b/changelogs/unreleased/-1x68xu9.yml @@ -0,0 +1,6 @@ +--- +title: Improved Code to prepare loader on app mounted and assign it to null on dismiss +ticket_id: "#1x68u9" +merge_request: 29 +author: Yashi Verma +type: changed \ No newline at end of file diff --git a/src/App.vue b/src/App.vue index a84d4623a..654755fa7 100644 --- a/src/App.vue +++ b/src/App.vue @@ -61,22 +61,31 @@ export default defineComponent({ }, async presentLoader() { - this.loader = await loadingController - .create({ - message: this.$t("Click the backdrop to dismiss."), - translucent: true, - backdropDismiss: true - }); - await this.loader.present(); + if (!this.loader) { + this.loader = await loadingController + .create({ + message: this.$t("Click the backdrop to dismiss."), + translucent: true, + backdropDismiss: true + }); + } + this.loader.present(); }, dismissLoader() { if (this.loader) { this.loader.dismiss(); + this.loader = null as any; } } }, - mounted() { + async mounted() { emitter.on('timeZoneDifferent', this.timeZoneDifferentAlert); + this.loader = await loadingController + .create({ + message: this.$t("Click the backdrop to dismiss."), + translucent: true, + backdropDismiss: true + }); emitter.on('presentLoader', this.presentLoader); emitter.on('dismissLoader', this.dismissLoader); },