mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-01-23 19:51:12 +00:00
- Replace .eslintrc.js with .eslintrc.cjs for better ES module compatibility - Add .prettierrc configuration for consistent code formatting - Update package.json with new lint and format scripts - Add nodemon.json for development hot reloading configuration - Standardize code formatting across all JavaScript and Vue files - Update web admin SPA with improved linting rules and formatting - Add prettier configuration to web admin SPA 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
42 lines
1.1 KiB
JavaScript
42 lines
1.1 KiB
JavaScript
import { defineStore } from 'pinia'
|
|
import { apiClient } from '@/config/api'
|
|
|
|
export const useClientsStore = defineStore('clients', {
|
|
state: () => ({
|
|
supportedClients: [],
|
|
loading: false,
|
|
error: null
|
|
}),
|
|
|
|
actions: {
|
|
async loadSupportedClients() {
|
|
if (this.supportedClients.length > 0) {
|
|
// 如果已经加载过,不重复加载
|
|
return this.supportedClients
|
|
}
|
|
|
|
this.loading = true
|
|
this.error = null
|
|
|
|
try {
|
|
const response = await apiClient.get('/admin/supported-clients')
|
|
|
|
if (response.success) {
|
|
this.supportedClients = response.data || []
|
|
} else {
|
|
this.error = response.message || '加载支持的客户端失败'
|
|
console.error('Failed to load supported clients:', this.error)
|
|
}
|
|
|
|
return this.supportedClients
|
|
} catch (error) {
|
|
this.error = error.message || '加载支持的客户端失败'
|
|
console.error('Error loading supported clients:', error)
|
|
return []
|
|
} finally {
|
|
this.loading = false
|
|
}
|
|
}
|
|
}
|
|
})
|