fix some bugs

This commit is contained in:
2026-08-03 11:52:44 +03:30
parent e41a898686
commit d6608283f6
13 changed files with 1016 additions and 53 deletions
+18 -25
View File
@@ -1,39 +1,32 @@
import { type ComputedRef, ref } from 'vue'
// import { get } from 'lodash'
import {defineStore} from "pinia";
import {getMe} from "@/api/me";
import {getFundTable} from "@/api/fund";
import type {Fund} from "@/models/fund";
import type {TableOutput} from "@/models/table";
import { ref } from 'vue'
import { defineStore } from 'pinia'
import { getFundTable } from '@/api/fund'
import type { Fund } from '@/models/fund'
import type { TableOutput } from '@/models/table'
import { getProductInventory } from '@/api/products'
export const useFundUserStore = defineStore('fund', () => {
const myFunds = ref<TableOutput<Fund> | undefined>(undefined)
const myPiggyFunds = ref<TableOutput<Fund> | undefined>(undefined)
async function getMyFund() {
try {
// console.log('fff')
myFunds.value = await getFundTable()
// دارایی‌ها — inventory؛ سازگار با صفحهٔ /fund
myFunds.value = await getProductInventory()
return myFunds.value
} catch (e) {
console.log(e)
}
}
/* const permissions: ComputedRef<string[]> = computed(() => {
const permissions: string[] = get(userInfo.value, 'permission', [])
const excludes: string[] = get(userInfo.value, 'exclude', [])
return permissions.filter((item) => !excludes.includes(item))
})*/
/*
function canAccess(permissionKey: string) {
if (isAdmin.value) return true
return permissions.value.includes(permissionKey)
async function getMyPiggyFunds() {
try {
myPiggyFunds.value = await getFundTable()
return myPiggyFunds.value
} catch (e) {
console.log(e)
}
}
*/
/*
const isAdmin = computed(() => {
return userInfo.value?.is_admin
})*/
return { getMyFund, myFunds/* permissions, canAccess, isAdmin*/ }
return { getMyFund, getMyPiggyFunds, myFunds, myPiggyFunds }
})