Skip to content

Open source personal finance application

chore(refactor): eslint fixes

ilkome8f1867f319ef
diff --git a/components/base/BottomSheet.vue b/components/base/BottomSheet.vue
index c0d1d2c0..fdd9f7ef 100644
--- a/components/base/BottomSheet.vue
+++ b/components/base/BottomSheet.vue
@@ -324,7 +324,7 @@ export default defineComponent({
/**
* Run init when mounted or show changed
*/
- watch(() => props.show, async() => {
+ watch(() => props.show, async () => {
if (!props.keepAlive || (props.keepAlive && props.show))
await init()
diff --git a/components/base/modal/useTouchClose.ts b/components/base/modal/useTouchClose.ts
index 7a77662c..ff891c67 100644
--- a/components/base/modal/useTouchClose.ts
+++ b/components/base/modal/useTouchClose.ts
@@ -40,7 +40,8 @@ export default function useOnTouch() {
}
if (!isInit) {
- if (!container.value) return
+ if (!container.value)
+ return
isInit = true
container.value.addEventListener('touchstart', onDragStart, { passive: true })
container.value.addEventListener('touchmove', onDragging, { passive: true })
@@ -53,7 +54,8 @@ export default function useOnTouch() {
* Translate
*/
function setTranslate(): void {
- if (!wrap.value) return
+ if (!wrap.value)
+ return
const offset = isDrugByHandler ? 0 : config.dragOffset
if (currentY === 0) {
@@ -91,28 +93,34 @@ export default function useOnTouch() {
// Check if should drag modal
else {
// Do not close modal inside this div
- if (event.target.closest(`.${config.doNotTouchClassName}`)) return
+ if (event.target.closest(`.${config.doNotTouchClassName}`))
+ return
// Stop drag when content has scroll
// wait until content scroll up to top
if (content.value) {
- if (content.value.scrollTop > 0) return
+ if (content.value.scrollTop > 0)
+ return
// wait until content scroll up inside Swiper
const waitForScrollSlider = content.value.querySelector(`.swiper-slide-active .${config.whaitForScrollClassName}`)
- if (waitForScrollSlider && waitForScrollSlider.scrollTop > 0) return
+ if (waitForScrollSlider && waitForScrollSlider.scrollTop > 0)
+ return
const waitForScrollSlider2 = content.value.querySelector(`.swiper-slide-active .${config.whaitForScrollSliderClassName}`)
- if (waitForScrollSlider2 && waitForScrollSlider2.scrollTop > 0) return
+ if (waitForScrollSlider2 && waitForScrollSlider2.scrollTop > 0)
+ return
// wait until content scroll up inside
const waitForScroll = content.value.querySelector(`.${config.whaitForScrollClassName}`)
- if (waitForScroll && waitForScroll.scrollTop > 0) return
+ if (waitForScroll && waitForScroll.scrollTop > 0)
+ return
}
}
// Drag inside wrap
- if (event.target.closest(`.${wrap.value.className}`)) isDragging = true
+ if (event.target.closest(`.${wrap.value.className}`))
+ isDragging = true
if (isDragging) {
event.type === 'touchstart'
@@ -145,7 +153,8 @@ export default function useOnTouch() {
else {
currentY = 0
setTranslate()
- if (isDragging) wrap.value.classList.add(config.animClassName)
+ if (isDragging)
+ wrap.value.classList.add(config.animClassName)
}
}
@@ -158,7 +167,8 @@ export default function useOnTouch() {
wrap.value.style.transform = ''
wrap.value.style.opacity = ''
overflow.value.style.opacity = ''
- if (onClose) onClose()
+ if (onClose)
+ onClose()
}
/**
@@ -173,7 +183,8 @@ export default function useOnTouch() {
wrap.value.style.transform = ''
wrap.value.style.opacity = ''
overflow.value.style.opacity = ''
- if (onClose) onClose()
+ if (onClose)
+ onClose()
return
}
@@ -196,7 +207,8 @@ export default function useOnTouch() {
* onUnmounted
*/
onUnmounted(() => {
- if (!container || !container.value) return
+ if (!container || !container.value)
+ return
container.value.removeEventListener('touchstart', onDragStart)
container.value.removeEventListener('touchmove', onDragging)
container.value.removeEventListener('touchend', onDragEnd)
diff --git a/components/categories/Delete.vue b/components/categories/Delete.vue
index e65f30ed..f4985272 100644
--- a/components/categories/Delete.vue
+++ b/components/categories/Delete.vue
@@ -56,7 +56,7 @@ async function onDeleteConfirm() {
router.push('/categories')
// Give some time to complete redirect
- setTimeout(async() => {
+ setTimeout(async () => {
await this.$store.dispatch('trns/deleteTrnsByIds', trnsIdsS)
removeData(`users/${uid}/categories/${categoryIdS}`)
.then(() => {
diff --git a/components/categories/Form.vue b/components/categories/Form.vue
index 939ba89b..0665216c 100644
--- a/components/categories/Form.vue
+++ b/components/categories/Form.vue
@@ -18,9 +18,10 @@ const props = defineProps<{
showStat: boolean
}
}>()
-const { categoryId, categoryForm } = toRefs(props)
+
const emit = defineEmits(['updateValue', 'afterSave'])
+const { categoryId, categoryForm } = toRefs(props)
const { $store, $notify, nuxt2Context: { i18n } } = useNuxtApp()
const editCategoryId = categoryId.value ?? generateId()
@@ -29,7 +30,8 @@ const isUpdateChildCategoriesColor = ref(true)
const isAllowChangeParent = computed(() => {
const childs = getChildCategoriesIds(categoryId.value)
- if (childs) return false
+ if (childs)
+ return false
return true
})
@@ -56,7 +58,8 @@ function findCategoryWithThisColor(color) {
* @param categoryId
*/
function getChildCategoriesIds(categoryId) {
- if (!categoryId) return false
+ if (!categoryId)
+ return false
const category = $store.state.categories.items[categoryId]
const categoriesItems = $store.state.categories.items
diff --git a/components/categories/Item.vue b/components/categories/Item.vue
index 7687c005..4a34afd4 100644
--- a/components/categories/Item.vue
+++ b/components/categories/Item.vue
@@ -18,7 +18,8 @@ export default defineComponent({
const parentCategory = computed(() => $store.state.categories.items[props.category?.parentId])
function onClickItem() {
- if (listeners.onClick) listeners.onClick(props.id)
+ if (listeners.onClick)
+ listeners.onClick(props.id)
}
function onClickIcon() {
diff --git a/components/categories/page/List.vue b/components/categories/page/List.vue
index 71dd5aef..1bc0c032 100644
--- a/components/categories/page/List.vue
+++ b/components/categories/page/List.vue
@@ -2,8 +2,10 @@
const { $store } = useNuxtApp()
const catsIds = computed(() => $store.getters['categories/categoriesRootIds']?.sort((a, b) => {
- if ($store.state.categories.items[a].name < $store.state.categories.items[b].name) return -1
- if ($store.state.categories.items[a].name > $store.state.categories.items[b].name) return 1
+ if ($store.state.categories.items[a].name < $store.state.categories.items[b].name)
+ return -1
+ if ($store.state.categories.items[a].name > $store.state.categories.items[b].name)
+ return 1
return 0
}))
</script>
diff --git a/components/categories/page/id/Index.vue b/components/categories/page/id/Index.vue
index cb86709c..bfc95322 100644
--- a/components/categories/page/id/Index.vue
+++ b/components/categories/page/id/Index.vue
@@ -19,8 +19,10 @@ const backLink = computed(() => category.value?.parentId ? `/categories/${catego
const filter = reactive({ trnType: null })
const categoryChildIds = computed(() => category.value.childIds?.sort((a, b) => {
- if ($store.state.categories.items[a].name < $store.state.categories.items[b].name) return -1
- if ($store.state.categories.items[a].name > $store.state.categories.items[b].name) return 1
+ if ($store.state.categories.items[a].name < $store.state.categories.items[b].name)
+ return -1
+ if ($store.state.categories.items[a].name > $store.state.categories.items[b].name)
+ return 1
return 0
}))
diff --git a/components/shared/inputs/Checkbox.vue b/components/shared/inputs/Checkbox.vue
index 80d7bd40..6f0b227d 100644
--- a/components/shared/inputs/Checkbox.vue
+++ b/components/shared/inputs/Checkbox.vue
@@ -1,4 +1,3 @@
-
<script>
export default {
props: {
diff --git a/components/stat/Date.vue b/components/stat/Date.vue
index 1f9c7de0..7f874108 100644
--- a/components/stat/Date.vue
+++ b/components/stat/Date.vue
@@ -1,9 +1,9 @@
<script setup lang="ts">
-const isShowDateSelector = ref(false)
defineProps<{
dateClasses?: null
wrapClasses?: null
}>()
+const isShowDateSelector = ref(false)
</script>
<template lang="pug">
diff --git a/components/stat/GroupItem.vue b/components/stat/GroupItem.vue
index 1fdc78d9..36c66841 100644
--- a/components/stat/GroupItem.vue
+++ b/components/stat/GroupItem.vue
@@ -1,11 +1,9 @@
<script setup lang="ts">
import useStatPage from '~/components/stat/useStatPage'
-const { statPage } = useStatPage()
-
defineProps<{
typeText: String
}>()
-
+const { statPage } = useStatPage()
</script>
<template lang="pug">
diff --git a/components/stat/Laptop.vue b/components/stat/Laptop.vue
index 5a30b4b2..9239bfd7 100644
--- a/components/stat/Laptop.vue
+++ b/components/stat/Laptop.vue
@@ -40,11 +40,11 @@ const isShowGroupTrns = computed(() => {
})
const chartKeyDirtyFix = ref('show')
-onActivated(async() => {
+onActivated(async () => {
await nextTick()
chartKeyDirtyFix.value = 'hide'
})
-onDeactivated(async() => {
+onDeactivated(async () => {
await nextTick()
chartKeyDirtyFix.value = 'show'
})
diff --git a/components/stat/StatItemChildCats.vue b/components/stat/StatItemChildCats.vue
index c09c55c4..a0c3f0af 100644
--- a/components/stat/StatItemChildCats.vue
+++ b/components/stat/StatItemChildCats.vue
@@ -1,4 +1,3 @@
-
<script>
export default {
name: 'StatItemChildCats',
@@ -28,8 +27,10 @@ export default {
}
stat = stat.sort((a, b) => {
- if (a[this.typeName] > b[this.typeName]) return -1
- if (a[this.typeName] < b[this.typeName]) return 1
+ if (a[this.typeName] > b[this.typeName])
+ return -1
+ if (a[this.typeName] < b[this.typeName])
+ return 1
return 0
})
diff --git a/components/stat/group/Chart.vue b/components/stat/group/Chart.vue
index 01c7e42f..7346e619 100644
--- a/components/stat/group/Chart.vue
+++ b/components/stat/group/Chart.vue
@@ -35,7 +35,7 @@ export default {
const chartObj = ref({})
const chartCallback = (v) => { chartObj.value = v }
- const onClickChart = async(event) => {
+ const onClickChart = async (event) => {
const chart = chartObj.value
if (!chart)
return
@@ -54,7 +54,7 @@ export default {
}, 100)
}
- watch(() => $store.state.filter.date, async() => {
+ watch(() => $store.state.filter.date, async () => {
await nextTick()
const chart = chartObj.value
@@ -114,10 +114,14 @@ export default {
const periodTotal = this.$store.getters['trns/getTotalOfTrnsIds'](trnsIds)
let format = 'MM'
- if (periodName === 'day') format = 'D.MM'
- if (periodName === 'week') format = 'D MMM'
- if (periodName === 'month') format = 'MMM'
- if (periodName === 'year') format = 'YYYY'
+ if (periodName === 'day')
+ format = 'D.MM'
+ if (periodName === 'week')
+ format = 'D MMM'
+ if (periodName === 'month')
+ format = 'MMM'
+ if (periodName === 'year')
+ format = 'YYYY'
const name = this.$day().startOf(periodName).subtract(index, periodName).format(format)
// Incomes
diff --git a/components/trnForm/Trns.vue b/components/trnForm/Trns.vue
index 37cd236d..cc7ff38b 100644
--- a/components/trnForm/Trns.vue
+++ b/components/trnForm/Trns.vue
@@ -49,7 +49,8 @@ export default defineComponent({
const trnsIds = getTrnsIds({ ...filter, trnsItems })
// limit
- if (this.limit > 0) return trnsIds.slice(0, this.limit)
+ if (this.limit > 0)
+ return trnsIds.slice(0, this.limit)
return trnsIds
},
diff --git a/components/trnForm/calculator/long-press-event.js b/components/trnForm/calculator/long-press-event.js
index aae70cc7..a18c26d7 100644
--- a/components/trnForm/calculator/long-press-event.js
+++ b/components/trnForm/calculator/long-press-event.js
@@ -5,7 +5,7 @@
* @author John Doherty <www.johndoherty.info>
* @license MIT
*/
-(function(window, document) {
+(function (window, document) {
'use strict'
// local timer object based on rAF
@@ -27,7 +27,7 @@
// patch CustomEvent to allow constructor creation (IE/Chrome)
if (typeof window.CustomEvent !== 'function') {
- window.CustomEvent = function(event, params) {
+ window.CustomEvent = function (event, params) {
params = params || { bubbles: false, cancelable: false, detail: undefined }
const evt = document.createEvent('CustomEvent')
@@ -39,12 +39,12 @@
}
// requestAnimationFrame() shim by Paul Irish
- window.requestAnimFrame = (function() {
+ window.requestAnimFrame = (function () {
return window.requestAnimationFrame
|| window.webkitRequestAnimationFrame
|| window.mozRequestAnimationFrame
|| window.oRequestAnimationFrame
- || window.msRequestAnimationFrame || function(callback) {
+ || window.msRequestAnimationFrame || function (callback) {
window.setTimeout(callback, 1000 / 60)
}
})()
@@ -58,12 +58,13 @@
function requestTimeout(fn, delay) {
if (!window.requestAnimationFrame && !window.webkitRequestAnimationFrame
&& !(window.mozRequestAnimationFrame && window.mozCancelRequestAnimationFrame) // Firefox 5 ships without cancel support
- && !window.oRequestAnimationFrame && !window.msRequestAnimationFrame) return window.setTimeout(fn, delay)
+ && !window.oRequestAnimationFrame && !window.msRequestAnimationFrame)
+ return window.setTimeout(fn, delay)
const start = new Date().getTime()
const handle = {}
- const loop = function() {
+ const loop = function () {
const current = new Date().getTime()
const delta = current - start
diff --git a/components/trnForm/calculator/useCalculator.ts b/components/trnForm/calculator/useCalculator.ts
index 7faf6007..77e60cf6 100644
--- a/components/trnForm/calculator/useCalculator.ts
+++ b/components/trnForm/calculator/useCalculator.ts
@@ -111,14 +111,17 @@ export default function useCalculator() {
// Delete
if (clearedExpression !== '0' && isDeleteAction) {
const deleteString = clearedExpression.slice(0, -1)
- if (deleteString) return deleteString
+ if (deleteString)
+ return deleteString
return '0'
}
// Start from 0
if (clearedExpression === '0') {
- if (value === '0') return expression
- if (!inputIsAction) return value
+ if (value === '0')
+ return expression
+ if (!inputIsAction)
+ return value
}
// Change math simbol
@@ -160,7 +163,8 @@ export default function useCalculator() {
// Check if math will success
if (lastSimbol !== '.') {
const result = makeCalculation(clearedExpression + value)
- if (result === '0') return clearedExpression
+ if (result === '0')
+ return clearedExpression
}
// Limit integer
@@ -223,15 +227,19 @@ export default function useCalculator() {
}
function keyboardHandler(event: KeyboardEvent): void {
- if (!isKeysActive.value) return
+ if (!isKeysActive.value)
+ return
const allowValue = (event.key).match(/[0-9%/*\-+=.,]|Backspace|Enter/)
let input = allowValue ? allowValue.input : false
if (input) {
- if (input === ',') input = '.'
- if (input === 'Enter') input = '='
- if (input === 'Backspace') input = 'delete'
+ if (input === ',')
+ input = '.'
+ if (input === 'Enter')
+ input = '='
+ if (input === 'Backspace')
+ input = 'delete'
handleTouch(input)
}
diff --git a/components/wallets/Delete.vue b/components/wallets/Delete.vue
index 0ae79894..59e3c298 100644
--- a/components/wallets/Delete.vue
+++ b/components/wallets/Delete.vue
@@ -42,7 +42,7 @@ async function onDeleteConfirm() {
router.push('/wallets')
// Give some time to complete redirect
- setTimeout(async() => {
+ setTimeout(async () => {
await this.$store.dispatch('trns/deleteTrnsByIds', trnsIdsS)
removeData(`users/${uid}/accounts/${walletIdS}`)
.then(() => {
diff --git a/components/wallets/Form.vue b/components/wallets/Form.vue
index 585b5599..971d8f67 100644
--- a/components/wallets/Form.vue
+++ b/components/wallets/Form.vue
@@ -7,9 +7,10 @@ const props = defineProps<{
walletId?: WalletID
walletForm: WalletForm
}>()
-const { walletId, walletForm } = toRefs(props)
+
const emit = defineEmits(['updateValue', 'afterSave'])
+const { walletId, walletForm } = toRefs(props)
const { $store, $notify, nuxt2Context: { i18n } } = useNuxtApp()
const editWalletId = walletId.value ?? generateId()
diff --git a/components/wallets/Sort.vue b/components/wallets/Sort.vue
index 98605f82..c9cf7e2f 100644
--- a/components/wallets/Sort.vue
+++ b/components/wallets/Sort.vue
@@ -28,7 +28,8 @@ export default {
sortedWallets,
)
if (result.succsess) {
- if (this.$listeners.closeModal) this.$listeners.closeModal()
+ if (this.$listeners.closeModal)
+ this.$listeners.closeModal()
this.$notify({
type: 'success',
title: random(successEmo),
diff --git a/components/welcome/CategoryForm.vue b/components/welcome/CategoryForm.vue
index 7235f9c6..ac385e18 100644
--- a/components/welcome/CategoryForm.vue
+++ b/components/welcome/CategoryForm.vue
@@ -3,9 +3,9 @@ import { allColors } from '~/assets/js/colors'
import { random } from '~/assets/js/emo'
import icons from '~/assets/js/icons'
-const { $store } = useNuxtApp()
const emit = defineEmits(['afterSave'])
+const { $store } = useNuxtApp()
const categoryForm = ref({
color: random(random(allColors)),
icon: random(random(icons)),
diff --git a/locales/ru-RU.js b/locales/ru-RU.js
index 8a4b2a74..5be019f4 100644
--- a/locales/ru-RU.js
+++ b/locales/ru-RU.js
@@ -1,4 +1,3 @@
-
export default {
common: {
date: 'Дата',
diff --git a/middleware/auth.js b/middleware/auth.js
index 14f47728..eff37c89 100755
--- a/middleware/auth.js
+++ b/middleware/auth.js
@@ -1,4 +1,4 @@
-export default function({ store, redirect, route, app }) {
+export default function ({ store, redirect, route, app }) {
const routeName = app.getRouteBaseName(route)
if (store.state.user.user !== null && routeName === 'login')
diff --git a/modules/filter/useFilter.ts b/modules/filter/useFilter.ts
index ad862e81..87f773c8 100644
--- a/modules/filter/useFilter.ts
+++ b/modules/filter/useFilter.ts
@@ -7,7 +7,8 @@ export default function useFilter() {
function scrollTop() {
const page = document.querySelector('.js_scroll_page')
- if (page) page.scrollTop = 0
+ if (page)
+ page.scrollTop = 0
}
function setFilterCatsId(catId) {
diff --git a/plugins/dayjs.js b/plugins/dayjs.js
index 5b222b40..495d69f6 100644
--- a/plugins/dayjs.js
+++ b/plugins/dayjs.js
@@ -18,7 +18,8 @@ export default (_, inject) => {
})
inject('day', (val) => {
- if (val) return dayjs(+val)
+ if (val)
+ return dayjs(+val)
return dayjs()
})
}
diff --git a/services/firebase/api.js b/services/firebase/api.js
index 75594af4..1fb83328 100644
--- a/services/firebase/api.js
+++ b/services/firebase/api.js
@@ -33,6 +33,6 @@ export const updateData = (path, updates) => update(ref(db, path), updates)
export const removeData = path => remove(ref(db, path))
-export const saveData = async(path, value) => await set(ref(db, path), value)
+export const saveData = async (path, value) => await set(ref(db, path), value)
export const unsubcribeData = path => off(ref(db, path))
diff --git a/store/app/actions.js b/store/app/actions.js
index 61169a99..16cd27f7 100644
--- a/store/app/actions.js
+++ b/store/app/actions.js
@@ -7,7 +7,7 @@ export default {
if (this.$router.currentRoute.name === 'login')
commit('setAppStatus', 'loading')
- onAuthStateChanged(auth, async(user) => {
+ onAuthStateChanged(auth, async (user) => {
if (this.$router.currentRoute.name === 'login')
commit('setAppStatus', 'loading')
@@ -54,13 +54,20 @@ export default {
localforage.getItem('finapp.filter.period'),
])
- if (ativeTab) dispatch('ui/setActiveTab', ativeTab, { root: true })
- if (user) commit('user/setUser', user, { root: true })
- if (currencies) commit('currencies/setCurrencies', currencies, { root: true })
- if (categories) commit('categories/setCategories', categories, { root: true })
- if (wallets) commit('wallets/setWallets', wallets, { root: true })
- if (trns) commit('trns/setTrns', trns, { root: true })
- if (filterPeriod) dispatch('filter/setPeriod', filterPeriod, { root: true })
+ if (ativeTab)
+ dispatch('ui/setActiveTab', ativeTab, { root: true })
+ if (user)
+ commit('user/setUser', user, { root: true })
+ if (currencies)
+ commit('currencies/setCurrencies', currencies, { root: true })
+ if (categories)
+ commit('categories/setCategories', categories, { root: true })
+ if (wallets)
+ commit('wallets/setWallets', wallets, { root: true })
+ if (trns)
+ commit('trns/setTrns', trns, { root: true })
+ if (filterPeriod)
+ dispatch('filter/setPeriod', filterPeriod, { root: true })
// ready
if (categories && user && trns && wallets) {
diff --git a/store/filter/actions.js b/store/filter/actions.js
index 878caab6..d8599c82 100644
--- a/store/filter/actions.js
+++ b/store/filter/actions.js
@@ -25,11 +25,13 @@ export default {
const trns = rootState.trns.items
const firstCreatedTrnIdFromSelectedTrns = rootGetters['trns/firstCreatedTrnIdFromSelectedTrns']
const firstCreatedTrn = trns[firstCreatedTrnIdFromSelectedTrns]
- if (!firstCreatedTrn) return
+ if (!firstCreatedTrn)
+ return
const firstCreatedTrnDate = dayjs(firstCreatedTrn.date).startOf(state.period).valueOf()
const filterDate = state.date
const nextDate = dayjs(filterDate).subtract(1, state.period).startOf(state.period).valueOf()
- if (nextDate >= firstCreatedTrnDate) commit('setPeriodNext', nextDate)
+ if (nextDate >= firstCreatedTrnDate)
+ commit('setPeriodNext', nextDate)
}
},
@@ -37,7 +39,8 @@ export default {
if (rootGetters['trns/hasTrns']) {
const filterDate = state.date
const nextDate = dayjs(filterDate).add(1, state.period).startOf(state.period).valueOf()
- if (nextDate < dayjs().valueOf()) commit('setPeriodPrev', nextDate)
+ if (nextDate < dayjs().valueOf())
+ commit('setPeriodPrev', nextDate)
}
},
}
diff --git a/store/filter/mutations.js b/store/filter/mutations.js
index 72263aa4..9e9a186c 100644
--- a/store/filter/mutations.js
+++ b/store/filter/mutations.js
@@ -23,7 +23,8 @@ export default {
// Wallets
setFilterWalletsId(state, walletId) {
- if (state.walletsIds.includes(walletId)) return
+ if (state.walletsIds.includes(walletId))
+ return
state.walletsIds.push(walletId)
},
@@ -37,7 +38,8 @@ export default {
// Cats
setFilterCatsId(state, catId) {
- if (state.catsIds.includes(catId)) return
+ if (state.catsIds.includes(catId))
+ return
state.catsIds.push(catId)
},
diff --git a/store/lang/actions.js b/store/lang/actions.js
index 24535985..cef941cc 100644
--- a/store/lang/actions.js
+++ b/store/lang/actions.js
@@ -18,15 +18,18 @@ export default {
async initLocalLang({ commit }) {
const localLang = await localforage.getItem('finapp.lang')
- if (localLang) commit('setLang', localLang)
+ if (localLang)
+ commit('setLang', localLang)
},
async initDbLang({ commit, rootGetters }) {
const uid = rootGetters['user/userUid']
- if (!uid) return
+ if (!uid)
+ return
const lang = await getDataOnce(`users/${uid}/settings/lang`)
- if (!lang) return
+ if (!lang)
+ return
commit('setLang', lang)
localforage.setItem('finapp.lang', lang)
diff --git a/store/trns/actions.js b/store/trns/actions.js
index 4d219a08..be94b4ed 100644
--- a/store/trns/actions.js
+++ b/store/trns/actions.js
@@ -54,7 +54,8 @@ export default {
})
setTimeout(() => {
- if (!isTrnSavedOnline) saveTrnToAddLaterLocal({ id, values })
+ if (!isTrnSavedOnline)
+ saveTrnToAddLaterLocal({ id, values })
}, 1000)
const { clearExpression } = useCalculator()
@@ -107,7 +108,7 @@ export default {
* and add trns to database
*/
uploadOfflineTrns({ dispatch, rootState }) {
- getDataAndWatch('.info/connected', async(isConnected) => {
+ getDataAndWatch('.info/connected', async (isConnected) => {
if (isConnected) {
const trnsArrayForDelete = await localforage.getItem('finapp.trns.offline.delete') || []
const trnsItemsForUpdate = await localforage.getItem('finapp.trns.offline.update') || {}
diff --git a/store/trns/helpers.js b/store/trns/helpers.js
index 648fed05..cdb761c7 100644
--- a/store/trns/helpers.js
+++ b/store/trns/helpers.js
@@ -1,7 +1,7 @@
import localforage from 'localforage'
// save added trn to local
-export const saveTrnToAddLaterLocal = async({ id, values }) => {
+export const saveTrnToAddLaterLocal = async ({ id, values }) => {
const trns = await localforage.getItem('finapp.trns.offline.update')
await localforage.setItem('finapp.trns.offline.update', {
...trns,
@@ -10,7 +10,7 @@ export const saveTrnToAddLaterLocal = async({ id, values }) => {
}
// remove added trn from local
-export const removeTrnToAddLaterLocal = async(id) => {
+export const removeTrnToAddLaterLocal = async (id) => {
const trns = await localforage.getItem('finapp.trns.offline.update') || {}
// console.log('removeTrnToAddLaterLocal', trns)
if (trns[id]) {
@@ -21,10 +21,11 @@ export const removeTrnToAddLaterLocal = async(id) => {
}
// save deleted trn to local
-export const saveTrnIDforDeleteWhenClientOnline = async(id) => {
+export const saveTrnIDforDeleteWhenClientOnline = async (id) => {
const trnsIds = await localforage.getItem('finapp.trns.offline.delete') || []
- if (trnsIds.includes(id)) return
+ if (trnsIds.includes(id))
+ return
await localforage.setItem('finapp.trns.offline.delete', [
...trnsIds,
@@ -33,7 +34,7 @@ export const saveTrnIDforDeleteWhenClientOnline = async(id) => {
}
// remove deleted trn from local
-export const removeTrnToDeleteLaterLocal = async(id) => {
+export const removeTrnToDeleteLaterLocal = async (id) => {
const trnsIds = await localforage.getItem('finapp.trns.offline.delete') || []
const trnId = trnsIds.find(trnId => trnId === id)
if (trnId) {
diff --git a/store/ui/actions.js b/store/ui/actions.js
index 0661de5d..ee8af85b 100644
--- a/store/ui/actions.js
+++ b/store/ui/actions.js
@@ -40,7 +40,8 @@ export default {
*/
setAppDimensions({ commit }, { height, width }) {
let view = 'mobile'
- if (width >= 1300) view = 'pc'
+ if (width >= 1300)
+ view = 'pc'
commit('setAppDimensions', {
mobile: view === 'mobile',
diff --git a/utils/debounce.js b/utils/debounce.js
index e0763c34..7f63f37a 100755
--- a/utils/debounce.js
+++ b/utils/debounce.js
@@ -1,8 +1,8 @@
export default function debounce(func, interval) {
let timeout
- return function() {
+ return function () {
const context = this; const args = arguments
- const later = function() {
+ const later = function () {
timeout = null
func.apply(context, args)
}
diff --git a/utils/id.js b/utils/id.js
index 7bf838cf..0edbea61 100644
--- a/utils/id.js
+++ b/utils/id.js
@@ -1,6 +1,6 @@
import dayjs from 'dayjs'
-export default function(date) {
+export default function (date) {
const string = Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15)
return `${dayjs(date).format('YYMMDD')}_${string.slice(0, 6)}`
}