adata-ui 0.1.62 → 0.1.63

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package-lock.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adata-ui",
3
- "version": "0.1.45",
3
+ "version": "0.1.62",
4
4
  "lockfileVersion": 1,
5
5
  "requires": true,
6
6
  "dependencies": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adata-ui",
3
- "version": "0.1.62",
3
+ "version": "0.1.63",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -383,17 +383,12 @@ export default {
383
383
  },
384
384
  mounted() {
385
385
  this.setBalance(this.balance);
386
- this.timer = setTimeout(this.fetchNotification, 3000);
386
+ this.notificationShow()
387
387
  },
388
388
  watch: {
389
389
  balance(newBalance) {
390
390
  this.setBalance(newBalance);
391
391
  },
392
- isOpenNotification() {
393
- if(!this.isOpenNotification) {
394
- clearTimeout(this.timer);
395
- }
396
- }
397
392
  },
398
393
  methods: {
399
394
  async fetchNotification() {
@@ -404,12 +399,24 @@ export default {
404
399
  if (data.details.length) {
405
400
  this.systemMessage = data.details[0].message;
406
401
  this.isOpenNotification = true;
402
+ localStorage.setItem('start_time', JSON.stringify(new Date()))
407
403
  }
408
404
 
409
405
  } catch(e) {
410
406
  console.log(e.message)
411
407
  }
412
408
  },
409
+ notificationShow() {
410
+ const startTime = localStorage.getItem('start_time');
411
+ let diffTime = startTime ? Math.round((new Date() - new Date(JSON.parse(startTime))) / 3600000): 0
412
+ if (startTime) {
413
+ if (diffTime >= 24) {
414
+ localStorage.removeItem('start_time')
415
+ }
416
+ } else {
417
+ this.fetchNotification()
418
+ }
419
+ },
413
420
  async fetchCurrencies() {
414
421
  try {
415
422
  const response = await fetch('https://users.adata.kz/api/v1/information/currency');