mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-16 16:07:33 +08:00
use for-of statements to replace for and for-in
This commit is contained in:
@@ -35,7 +35,7 @@ export function useExchangeRatesPageBase() {
|
||||
return getAllDisplayExchangeRates(exchangeRatesData.value);
|
||||
});
|
||||
|
||||
function getConvertedAmount(baseAmount: number | '', fromExchangeRate: LatestExchangeRate | LocalizedLatestExchangeRate, toExchangeRate: LatestExchangeRate | LocalizedLatestExchangeRate): number | '' | null {
|
||||
function getConvertedAmount(baseAmount: number | '', fromExchangeRate?: LatestExchangeRate | LocalizedLatestExchangeRate, toExchangeRate?: LatestExchangeRate | LocalizedLatestExchangeRate): number | '' | null {
|
||||
if (!fromExchangeRate || !toExchangeRate) {
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -52,8 +52,8 @@ export function useAccountEditPageBaseBase() {
|
||||
}
|
||||
|
||||
if (account.value.type === AccountType.MultiSubAccounts.type) {
|
||||
for (let i = 0; i < subAccounts.value.length; i++) {
|
||||
problemMessage = getInputEmptyProblemMessage(subAccounts.value[i], true);
|
||||
for (const subAccount of subAccounts.value) {
|
||||
problemMessage = getInputEmptyProblemMessage(subAccount, true);
|
||||
|
||||
if (problemMessage) {
|
||||
return problemMessage;
|
||||
@@ -132,9 +132,9 @@ export function useAccountEditPageBaseBase() {
|
||||
subAccounts.value = [];
|
||||
|
||||
if (newAccount.subAccounts && newAccount.subAccounts.length > 0) {
|
||||
for (let i = 0; i < newAccount.subAccounts.length; i++) {
|
||||
for (const oldSubAccount of newAccount.subAccounts) {
|
||||
const subAccount: Account = account.value.createNewSubAccount(userStore.currentUserDefaultCurrency, getCurrentUnixTime());
|
||||
subAccount.fillFrom(newAccount.subAccounts[i]);
|
||||
subAccount.fillFrom(oldSubAccount);
|
||||
|
||||
subAccounts.value.push(subAccount);
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ export function useReconciliationStatementPageBase() {
|
||||
let currency = defaultCurrency.value;
|
||||
|
||||
if (allAccountsMap.value[transaction.sourceAccountId]) {
|
||||
currency = allAccountsMap.value[transaction.sourceAccountId].currency;
|
||||
currency = allAccountsMap.value[transaction.sourceAccountId]!.currency;
|
||||
}
|
||||
|
||||
return formatAmountToLocalizedNumeralsWithCurrency(transaction.sourceAmount, currency);
|
||||
@@ -160,7 +160,7 @@ export function useReconciliationStatementPageBase() {
|
||||
let currency = defaultCurrency.value;
|
||||
|
||||
if (allAccountsMap.value[transaction.destinationAccountId]) {
|
||||
currency = allAccountsMap.value[transaction.destinationAccountId].currency;
|
||||
currency = allAccountsMap.value[transaction.destinationAccountId]!.currency;
|
||||
}
|
||||
|
||||
return formatAmountToLocalizedNumeralsWithCurrency(transaction.destinationAmount, currency);
|
||||
@@ -172,12 +172,12 @@ export function useReconciliationStatementPageBase() {
|
||||
|
||||
if (transaction.type === TransactionType.Transfer && transaction.destinationAccountId === accountId.value) {
|
||||
if (allAccountsMap.value[transaction.destinationAccountId]) {
|
||||
currency = allAccountsMap.value[transaction.destinationAccountId].currency;
|
||||
isLiabilityAccount = allAccountsMap.value[transaction.destinationAccountId].isLiability;
|
||||
currency = allAccountsMap.value[transaction.destinationAccountId]!.currency;
|
||||
isLiabilityAccount = allAccountsMap.value[transaction.destinationAccountId]!.isLiability;
|
||||
}
|
||||
} else if (allAccountsMap.value[transaction.sourceAccountId]) {
|
||||
currency = allAccountsMap.value[transaction.sourceAccountId].currency;
|
||||
isLiabilityAccount = allAccountsMap.value[transaction.sourceAccountId].isLiability;
|
||||
currency = allAccountsMap.value[transaction.sourceAccountId]!.currency;
|
||||
isLiabilityAccount = allAccountsMap.value[transaction.sourceAccountId]!.isLiability;
|
||||
}
|
||||
|
||||
if (isLiabilityAccount) {
|
||||
|
||||
@@ -8,6 +8,7 @@ import { useTransactionsStore } from '@/stores/transaction.ts';
|
||||
import { useStatisticsStore } from '@/stores/statistics.ts';
|
||||
import { useOverviewStore } from '@/stores/overview.ts';
|
||||
|
||||
import { keys, keysIfValueEquals, values } from '@/core/base.ts';
|
||||
import { CategoryType } from '@/core/category.ts';
|
||||
import type { TransactionCategory, TransactionCategoriesWithVisibleCount } from '@/models/transaction_category.ts';
|
||||
|
||||
@@ -80,13 +81,7 @@ export function useCategoryFilterSettingPageBase(type?: CategoryFilterType, allo
|
||||
function loadFilterCategoryIds(): boolean {
|
||||
const allCategoryIds: Record<string, boolean> = {};
|
||||
|
||||
for (const categoryId in transactionCategoriesStore.allTransactionCategoriesMap) {
|
||||
if (!Object.prototype.hasOwnProperty.call(transactionCategoriesStore.allTransactionCategoriesMap, categoryId)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const category = transactionCategoriesStore.allTransactionCategoriesMap[categoryId];
|
||||
|
||||
for (const category of values(transactionCategoriesStore.allTransactionCategoriesMap)) {
|
||||
if (allowCategoryTypes && !allowCategoryTypes[category.type]) {
|
||||
continue;
|
||||
}
|
||||
@@ -108,17 +103,13 @@ export function useCategoryFilterSettingPageBase(type?: CategoryFilterType, allo
|
||||
filterCategoryIds.value = Object.assign(allCategoryIds, settingsStore.appSettings.overviewTransactionCategoryFilterInHomePage);
|
||||
return true;
|
||||
} else if (type === 'transactionListCurrent') {
|
||||
for (const categoryId in transactionsStore.allFilterCategoryIds) {
|
||||
if (!Object.prototype.hasOwnProperty.call(transactionsStore.allFilterCategoryIds, categoryId)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (const categoryId of keysIfValueEquals(transactionsStore.allFilterCategoryIds, true)) {
|
||||
const category = transactionCategoriesStore.allTransactionCategoriesMap[categoryId];
|
||||
|
||||
if (category && (!category.subCategories || !category.subCategories.length)) {
|
||||
allCategoryIds[category.id] = false;
|
||||
} else if (category) {
|
||||
selectAllSubCategories(allCategoryIds, category, false);
|
||||
selectAllSubCategories(allCategoryIds, false, category);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,11 +126,7 @@ export function useCategoryFilterSettingPageBase(type?: CategoryFilterType, allo
|
||||
let finalCategoryIds = '';
|
||||
let changed = true;
|
||||
|
||||
for (const categoryId in filterCategoryIds.value) {
|
||||
if (!Object.prototype.hasOwnProperty.call(filterCategoryIds.value, categoryId)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (const categoryId of keys(filterCategoryIds.value)) {
|
||||
const category = transactionCategoriesStore.allTransactionCategoriesMap[categoryId];
|
||||
|
||||
if (!category) {
|
||||
|
||||
@@ -396,9 +396,9 @@ export function useTransactionEditPageBase(type: TransactionEditPageType, initMo
|
||||
});
|
||||
|
||||
watch(() => transaction.value.timeZone, (newValue) => {
|
||||
for (let i = 0; i < allTimezones.value.length; i++) {
|
||||
if (allTimezones.value[i].name === newValue) {
|
||||
transaction.value.utcOffset = allTimezones.value[i].utcOffsetMinutes;
|
||||
for (const timezone of allTimezones.value) {
|
||||
if (timezone.name === newValue) {
|
||||
transaction.value.utcOffset = timezone.utcOffsetMinutes;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -260,7 +260,7 @@ const selectedAccount = computed<Account>(() => {
|
||||
return account.value;
|
||||
}
|
||||
|
||||
return subAccounts.value[currentAccountIndex.value];
|
||||
return subAccounts.value[currentAccountIndex.value] as Account;
|
||||
});
|
||||
|
||||
const accountAmountTitle = computed<string>(() => {
|
||||
|
||||
@@ -248,7 +248,7 @@ function updateCategorySelected(category: TransactionCategory, value: boolean |
|
||||
}
|
||||
|
||||
function updateAllSubCategoriesSelected(category: TransactionCategory, value: boolean | null): void {
|
||||
selectAllSubCategories(filterCategoryIds.value, category, !value);
|
||||
selectAllSubCategories(filterCategoryIds.value, !value, category);
|
||||
|
||||
if (props.autoSave) {
|
||||
save();
|
||||
|
||||
@@ -1888,11 +1888,11 @@ function setImportFile(event: Event): void {
|
||||
|
||||
const el = event.target as HTMLInputElement;
|
||||
|
||||
if (!el.files || !el.files.length) {
|
||||
if (!el.files || !el.files.length || !el.files[0]) {
|
||||
return;
|
||||
}
|
||||
|
||||
importFile.value = el.files[0];
|
||||
importFile.value = el.files[0] as File;
|
||||
el.value = '';
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ import { useI18n } from '@/locales/helpers.ts';
|
||||
import { useTransactionCategoriesStore } from '@/stores/transactionCategory.ts';
|
||||
import { useTransactionTagsStore } from '@/stores/transactionTag.ts';
|
||||
|
||||
import type { NameValue } from '@/core/base.ts';
|
||||
import { type NameValue, values } from '@/core/base.ts';
|
||||
import { CategoryType } from '@/core/category.ts';
|
||||
import { AUTOMATICALLY_CREATED_CATEGORY_ICON_ID } from '@/consts/icon.ts';
|
||||
import { DEFAULT_CATEGORY_COLOR } from '@/consts/color.ts';
|
||||
@@ -140,9 +140,7 @@ function buildBatchCreateCategoryResponse(createdCategories: Record<number, Tran
|
||||
displayNameSourceItemMap[item.name] = item.value;
|
||||
}
|
||||
|
||||
for (const categoryType in createdCategories) {
|
||||
const categories = createdCategories[categoryType];
|
||||
|
||||
for (const categories of values(createdCategories)) {
|
||||
for (const category of categories) {
|
||||
if (!category.subCategories || category.subCategories.length < 1) {
|
||||
continue;
|
||||
|
||||
@@ -1168,11 +1168,11 @@ function uploadPicture(event: Event): void {
|
||||
|
||||
const el = event.target as HTMLInputElement;
|
||||
|
||||
if (!el.files || !el.files.length) {
|
||||
if (!el.files || !el.files.length || !el.files[0]) {
|
||||
return;
|
||||
}
|
||||
|
||||
const pictureFile = el.files[0];
|
||||
const pictureFile = el.files[0] as File;
|
||||
|
||||
el.value = '';
|
||||
|
||||
|
||||
@@ -536,11 +536,11 @@ function updateAvatar(event: Event): void {
|
||||
|
||||
const el = event.target as HTMLInputElement;
|
||||
|
||||
if (!el.files || !el.files.length) {
|
||||
if (!el.files || !el.files.length || !el.files[0]) {
|
||||
return;
|
||||
}
|
||||
|
||||
const avatarFile = el.files[0];
|
||||
const avatarFile = el.files[0] as File;
|
||||
|
||||
el.value = '';
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@
|
||||
:after="account.type === AccountType.SingleAccount.type ? accountBalance(account) : ''"
|
||||
:link="!sortable ? '/transaction/list?accountIds=' + account.id : null"
|
||||
:key="account.id"
|
||||
v-for="account in allCategorizedAccountsMap[accountCategory.type].accounts"
|
||||
v-for="account in allCategorizedAccountsMap[accountCategory.type]!.accounts"
|
||||
v-show="showHidden || !account.hidden"
|
||||
@taphold="setSortable()"
|
||||
>
|
||||
|
||||
@@ -166,7 +166,7 @@
|
||||
<f7-list-item chevron-center
|
||||
:key="item.index"
|
||||
:id="item.transaction ? getTransactionDomId(item.transaction) : undefined"
|
||||
:class="{ 'transaction-info': item.type == 'transaction', 'last-transaction-of-day': allReconciliationStatementVirtualListItems[item.index + 1] && allReconciliationStatementVirtualListItems[item.index + 1].type === 'date', 'reconciliation-statement-transaction-date': item.type == 'date' }"
|
||||
:class="{ 'transaction-info': item.type == 'transaction', 'last-transaction-of-day': allReconciliationStatementVirtualListItems[item.index + 1] && allReconciliationStatementVirtualListItems[item.index + 1]!.type === 'date', 'reconciliation-statement-transaction-date': item.type == 'date' }"
|
||||
:style="`top: ${virtualDataItems.topPosition}px`"
|
||||
:virtual-list-index="item.index"
|
||||
:swipeout="item.type === 'transaction' && !!item.transaction"
|
||||
@@ -204,7 +204,7 @@
|
||||
{{ tt('Modify Balance') }}
|
||||
</span>
|
||||
<span v-else-if="item.transaction.type !== TransactionType.ModifyBalance && allCategoriesMap[item.transaction.categoryId]">
|
||||
{{ allCategoriesMap[item.transaction.categoryId].name }}
|
||||
{{ allCategoriesMap[item.transaction.categoryId]!.name }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -466,8 +466,7 @@ const allReconciliationStatementVirtualListItems = computed<ReconciliationStatem
|
||||
let index = 0;
|
||||
let lastDisplayDate: string | null = null;
|
||||
|
||||
for (let i = 0; i < reconciliationStatements.value.transactions.length; i++) {
|
||||
const transaction = reconciliationStatements.value.transactions[i];
|
||||
for (const transaction of reconciliationStatements.value.transactions) {
|
||||
const displayDate = getDisplayDate(transaction);
|
||||
|
||||
if (lastDisplayDate !== displayDate) {
|
||||
|
||||
@@ -47,22 +47,22 @@
|
||||
:key="accountCategory.category"
|
||||
v-for="accountCategory in allCategorizedAccounts"
|
||||
v-show="showHidden || accountCategory.allVisibleAccountCount > 0">
|
||||
<f7-accordion-item :opened="collapseStates[accountCategory.category].opened"
|
||||
@accordion:open="collapseStates[accountCategory.category].opened = true"
|
||||
@accordion:close="collapseStates[accountCategory.category].opened = false">
|
||||
<f7-accordion-item :opened="collapseStates[accountCategory.category]!.opened"
|
||||
@accordion:open="collapseStates[accountCategory.category]!.opened = true"
|
||||
@accordion:close="collapseStates[accountCategory.category]!.opened = false">
|
||||
<f7-block-title>
|
||||
<f7-accordion-toggle>
|
||||
<f7-list strong inset dividers
|
||||
class="combination-list-header"
|
||||
:class="collapseStates[accountCategory.category].opened ? 'combination-list-opened' : 'combination-list-closed'">
|
||||
:class="collapseStates[accountCategory.category]!.opened ? 'combination-list-opened' : 'combination-list-closed'">
|
||||
<f7-list-item group-title>
|
||||
<small>{{ tt(accountCategory.name) }}</small>
|
||||
<f7-icon class="combination-list-chevron-icon" :f7="collapseStates[accountCategory.category].opened ? 'chevron_up' : 'chevron_down'"></f7-icon>
|
||||
<f7-icon class="combination-list-chevron-icon" :f7="collapseStates[accountCategory.category]!.opened ? 'chevron_up' : 'chevron_down'"></f7-icon>
|
||||
</f7-list-item>
|
||||
</f7-list>
|
||||
</f7-accordion-toggle>
|
||||
</f7-block-title>
|
||||
<f7-accordion-content :style="{ height: collapseStates[accountCategory.category].opened ? 'auto' : '' }">
|
||||
<f7-accordion-content :style="{ height: collapseStates[accountCategory.category]!.opened ? 'auto' : '' }">
|
||||
<f7-list strong inset dividers accordion-list class="combination-list-content">
|
||||
<f7-list-item checkbox
|
||||
:class="{ 'has-child-list-item': account.type === AccountType.MultiSubAccounts.type && ((showHidden && accountCategory.allSubAccounts[account.id]) || accountCategory.allVisibleSubAccountCounts[account.id]) }"
|
||||
@@ -189,9 +189,7 @@ function getCollapseStates(): Record<number, CollapseState> {
|
||||
const collapseStates: Record<number, CollapseState> = {};
|
||||
const allCategories = AccountCategory.values();
|
||||
|
||||
for (let i = 0; i < allCategories.length; i++) {
|
||||
const accountCategory = allCategories[i];
|
||||
|
||||
for (const accountCategory of allCategories) {
|
||||
collapseStates[accountCategory.type] = {
|
||||
opened: true
|
||||
};
|
||||
|
||||
@@ -52,22 +52,22 @@
|
||||
:key="categoryType.type"
|
||||
v-for="categoryType in allTransactionCategories"
|
||||
v-else-if="!loading">
|
||||
<f7-accordion-item :opened="collapseStates[categoryType.type].opened"
|
||||
@accordion:open="collapseStates[categoryType.type].opened = true"
|
||||
@accordion:close="collapseStates[categoryType.type].opened = false">
|
||||
<f7-accordion-item :opened="collapseStates[categoryType.type]!.opened"
|
||||
@accordion:open="collapseStates[categoryType.type]!.opened = true"
|
||||
@accordion:close="collapseStates[categoryType.type]!.opened = false">
|
||||
<f7-block-title>
|
||||
<f7-accordion-toggle>
|
||||
<f7-list strong inset dividers
|
||||
class="combination-list-header"
|
||||
:class="collapseStates[categoryType.type].opened ? 'combination-list-opened' : 'combination-list-closed'">
|
||||
:class="collapseStates[categoryType.type]!.opened ? 'combination-list-opened' : 'combination-list-closed'">
|
||||
<f7-list-item group-title>
|
||||
<small>{{ getCategoryTypeName(categoryType.type) }}</small>
|
||||
<f7-icon class="combination-list-chevron-icon" :f7="collapseStates[categoryType.type].opened ? 'chevron_up' : 'chevron_down'"></f7-icon>
|
||||
<f7-icon class="combination-list-chevron-icon" :f7="collapseStates[categoryType.type]!.opened ? 'chevron_up' : 'chevron_down'"></f7-icon>
|
||||
</f7-list-item>
|
||||
</f7-list>
|
||||
</f7-accordion-toggle>
|
||||
</f7-block-title>
|
||||
<f7-accordion-content :style="{ height: collapseStates[categoryType.type].opened ? 'auto' : '' }">
|
||||
<f7-accordion-content :style="{ height: collapseStates[categoryType.type]!.opened ? 'auto' : '' }">
|
||||
<f7-list strong inset dividers accordion-list class="combination-list-content" v-if="!hasAvailableCategory[categoryType.type]">
|
||||
<f7-list-item :title="tt('No available category')"></f7-list-item>
|
||||
</f7-list>
|
||||
@@ -242,7 +242,7 @@ function updateAllSubCategoriesSelected(e: Event): void {
|
||||
const categoryId = target.value;
|
||||
const category = transactionCategoriesStore.allTransactionCategoriesMap[categoryId];
|
||||
|
||||
selectAllSubCategories(filterCategoryIds.value, category, !target.checked);
|
||||
selectAllSubCategories(filterCategoryIds.value, !target.checked, category);
|
||||
}
|
||||
|
||||
function selectAllCategories(): void {
|
||||
|
||||
@@ -51,22 +51,22 @@
|
||||
</f7-list-item>
|
||||
</f7-list>
|
||||
|
||||
<f7-accordion-item :opened="collapseStates['default'].opened"
|
||||
@accordion:open="collapseStates['default'].opened = true"
|
||||
@accordion:close="collapseStates['default'].opened = false">
|
||||
<f7-accordion-item :opened="collapseStates['default']!.opened"
|
||||
@accordion:open="collapseStates['default']!.opened = true"
|
||||
@accordion:close="collapseStates['default']!.opened = false">
|
||||
<f7-block-title>
|
||||
<f7-accordion-toggle>
|
||||
<f7-list strong inset dividers
|
||||
class="combination-list-header"
|
||||
:class="collapseStates['default'].opened ? 'combination-list-opened' : 'combination-list-closed'">
|
||||
:class="collapseStates['default']!.opened ? 'combination-list-opened' : 'combination-list-closed'">
|
||||
<f7-list-item group-title>
|
||||
<small>{{ tt('Tags') }}</small>
|
||||
<f7-icon class="combination-list-chevron-icon" :f7="collapseStates['default'].opened ? 'chevron_up' : 'chevron_down'"></f7-icon>
|
||||
<f7-icon class="combination-list-chevron-icon" :f7="collapseStates['default']!.opened ? 'chevron_up' : 'chevron_down'"></f7-icon>
|
||||
</f7-list-item>
|
||||
</f7-list>
|
||||
</f7-accordion-toggle>
|
||||
</f7-block-title>
|
||||
<f7-accordion-content :style="{ height: collapseStates['default'].opened ? 'auto' : '' }">
|
||||
<f7-accordion-content :style="{ height: collapseStates['default']!.opened ? 'auto' : '' }">
|
||||
<f7-list strong inset dividers accordion-list class="combination-list-content">
|
||||
<f7-list-item checkbox
|
||||
:title="transactionTag.name"
|
||||
|
||||
@@ -119,13 +119,13 @@ function init(): void {
|
||||
if (isString(query['value'])) {
|
||||
try {
|
||||
const filterItems = query['value'].split(':');
|
||||
const amountCount = getAmountFilterParameterCount(filterItems[0]);
|
||||
const amountCount = getAmountFilterParameterCount(filterItems[0] as string);
|
||||
|
||||
if (filterItems.length === 2 && amountCount === 1) {
|
||||
queryAmount1 = parseInt(filterItems[1]);
|
||||
queryAmount1 = parseInt(filterItems[1] as string);
|
||||
} else if (filterItems.length === 3 && amountCount === 2) {
|
||||
queryAmount1 = parseInt(filterItems[1]);
|
||||
queryAmount2 = parseInt(filterItems[2]);
|
||||
queryAmount1 = parseInt(filterItems[1] as string);
|
||||
queryAmount2 = parseInt(filterItems[2] as string);
|
||||
}
|
||||
} catch (ex) {
|
||||
logger.warn('cannot parse amount from filter value, original value is ' + query['value'], ex);
|
||||
|
||||
@@ -721,9 +721,9 @@ const transactionDisplayScheduledFrequency = computed<string>(() => {
|
||||
const items = (template.scheduledFrequency || '').split(',');
|
||||
const scheduledFrequencyValues: number[] = [];
|
||||
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
if (items[i]) {
|
||||
scheduledFrequencyValues.push(parseInt(items[i]));
|
||||
for (const item of items) {
|
||||
if (item) {
|
||||
scheduledFrequencyValues.push(parseInt(item));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -912,7 +912,7 @@ function init(): void {
|
||||
if (query['id'] && responses[4] instanceof Transaction) {
|
||||
fromTransaction = responses[4];
|
||||
} else if (query['templateId'] && transactionTemplatesStore.allTransactionTemplatesMap && transactionTemplatesStore.allTransactionTemplatesMap[TemplateType.Normal.type]) {
|
||||
fromTransaction = transactionTemplatesStore.allTransactionTemplatesMap[TemplateType.Normal.type][query['templateId']];
|
||||
fromTransaction = (transactionTemplatesStore.allTransactionTemplatesMap[TemplateType.Normal.type] as Record<string, TransactionTemplate>)[query['templateId']] ?? null;
|
||||
|
||||
if (fromTransaction) {
|
||||
addByTemplateId.value = fromTransaction.id;
|
||||
@@ -1163,7 +1163,7 @@ function uploadPicture(event: Event): void {
|
||||
return;
|
||||
}
|
||||
|
||||
const pictureFile = el.files[0];
|
||||
const pictureFile = el.files[0] as File;
|
||||
|
||||
el.value = '';
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@ import { useI18nUIComponents, showLoading, hideLoading, onSwipeoutDeleted } from
|
||||
|
||||
import { useTokensStore } from '@/stores/token.ts';
|
||||
|
||||
import { itemAndIndex, reversedItemAndIndex } from '@/core/base.ts';
|
||||
import { TextDirection } from '@/core/text.ts';
|
||||
import { type TokenInfoResponse, SessionInfo } from '@/models/token.ts';
|
||||
|
||||
@@ -94,8 +95,7 @@ const sessions = computed<MobilePageSessionInfo[]>(() => {
|
||||
return sessions;
|
||||
}
|
||||
|
||||
for (let i = 0; i < tokens.value.length; i++) {
|
||||
const token = tokens.value[i];
|
||||
for (const token of tokens.value) {
|
||||
const sessionInfo = parseSessionInfo(token);
|
||||
sessions.push(new MobilePageSessionInfo(sessionInfo));
|
||||
}
|
||||
@@ -171,9 +171,9 @@ function revoke(session: SessionInfo): void {
|
||||
hideLoading();
|
||||
|
||||
onSwipeoutDeleted(getTokenDomId(session.tokenId), () => {
|
||||
for (let i = 0; i < tokens.value.length; i++) {
|
||||
if (tokens.value[i].tokenId === session.tokenId) {
|
||||
tokens.value.splice(i, 1);
|
||||
for (const [ token, index ] of itemAndIndex(tokens.value)) {
|
||||
if (token.tokenId === session.tokenId) {
|
||||
tokens.value.splice(index, 1);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -198,9 +198,9 @@ function revokeAll(): void {
|
||||
tokensStore.revokeAllTokens().then(() => {
|
||||
hideLoading();
|
||||
|
||||
for (let i = tokens.value.length - 1; i >= 0; i--) {
|
||||
if (!tokens.value[i].isCurrent) {
|
||||
tokens.value.splice(i, 1);
|
||||
for (const [ token, index ] of reversedItemAndIndex(tokens.value)) {
|
||||
if (!token.isCurrent) {
|
||||
tokens.value.splice(index, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -666,9 +666,9 @@ const allLanguages = computed<LanguageOption[]>(() => getAllLanguageOptions(true
|
||||
const allCurrencies = computed<LocalizedCurrencyInfo[]>(() => getAllCurrencies());
|
||||
|
||||
const currentLanguageName = computed<string>(() => {
|
||||
for (let i = 0; i < allLanguages.value.length; i++) {
|
||||
if (allLanguages.value[i].languageTag === newProfile.value.language) {
|
||||
return allLanguages.value[i].nativeDisplayName;
|
||||
for (const lang of allLanguages.value) {
|
||||
if (lang.languageTag === newProfile.value.language) {
|
||||
return lang.nativeDisplayName;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user