refactor: 规范化代码.

This commit is contained in:
lijiahang
2023-11-14 19:28:51 +08:00
parent d4c21a2324
commit 34ea140004
14 changed files with 148 additions and 60 deletions

View File

@@ -2,7 +2,7 @@ import type { CacheState } from './types';
import { defineStore } from 'pinia';
export type CacheType = 'users' | 'menus' | 'roles'
| 'host' | 'hostTags' | 'hostKeys' | 'hostIdentities'
| 'host' | 'hostGroups' | 'hostTags' | 'hostKeys' | 'hostIdentities'
| 'dictKeys' | string
export default defineStore('cache', {
@@ -11,6 +11,7 @@ export default defineStore('cache', {
menus: [],
roles: [],
hosts: [],
hostGroups: [],
hostTags: [],
hostKeys: [],
hostIdentities: [],

View File

@@ -2,10 +2,11 @@ import type { UserQueryResponse } from '@/api/user/user';
import type { MenuQueryResponse } from '@/api/system/menu';
import type { RoleQueryResponse } from '@/api/user/role';
import type { TagQueryResponse } from '@/api/meta/tag';
import type { HostQueryResponse } from '@/api/asset/host';
import type { HostGroupQueryResponse } from '@/api/asset/host-group';
import type { HostKeyQueryResponse } from '@/api/asset/host-key';
import type { HostIdentityQueryResponse } from '@/api/asset/host-identity';
import type { DictKeyQueryResponse } from '@/api/system/dict-key';
import type { HostQueryResponse } from '@/api/asset/host';
export interface CacheState {
users: UserQueryResponse[];
@@ -13,6 +14,7 @@ export interface CacheState {
roles: RoleQueryResponse[];
hostTags: TagQueryResponse[];
hosts: HostQueryResponse[];
hostGroups: HostGroupQueryResponse[];
hostKeys: HostKeyQueryResponse[];
hostIdentities: HostIdentityQueryResponse[];
dictKeys: DictKeyQueryResponse[];