Compare commits

..
5 Commits
Author SHA1 Message Date
xrain 7dbb48ad90 fix config
Publish to npm / publish (push) Failing after 10s
2026-08-10 21:15:53 +08:00
xrain 88af4a2d96 fix config
Publish to npm / publish (push) Failing after 10s
2026-08-10 21:03:44 +08:00
xrain 9e44c6fcaf fix config
Publish to npm / publish (push) Failing after 10s
2026-08-10 21:01:21 +08:00
xrain 592607f1e2 fix config
Publish to npm / publish (push) Failing after 8s
2026-08-10 20:46:40 +08:00
xrain 7aee4b708d fix config
Publish to npm / publish (push) Failing after 8s
2026-08-10 20:44:33 +08:00
2 changed files with 7 additions and 7 deletions
+6 -6
View File
@@ -84,7 +84,7 @@ export class SimApiCore {
logout_url: '/auth/logout', logout_url: '/auth/logout',
login_url: '/auth/login', login_url: '/auth/login',
} }
webConfig: Map<string, Map<string, object>> = new Map(); private webConfig: Map<string, Record<string, object>> = new Map();
private api: SimApiApiConfig = { private api: SimApiApiConfig = {
endpoints: {default: ''}, endpoints: {default: ''},
@@ -213,7 +213,7 @@ export class SimApiCore {
console.log('[DEBUG]', ...args) console.log('[DEBUG]', ...args)
} }
async getConfig(reload: boolean = false, endpointName: string = 'default'): Promise<Map<string, object>> { async getConfig(reload: boolean = false, endpointName: string = 'default'): Promise<Record<string, object>> {
if (!this.webConfig.has(endpointName) || reload) { if (!this.webConfig.has(endpointName) || reload) {
const versions: SimApiVersions = { const versions: SimApiVersions = {
uiApp: typeof AppVersion === 'undefined' ? "0.0.0-develop" : AppVersion, uiApp: typeof AppVersion === 'undefined' ? "0.0.0-develop" : AppVersion,
@@ -225,7 +225,7 @@ export class SimApiCore {
}; };
const resp = await this.query<any>('/config', {}, endpointName) const resp = await this.query<any>('/config', {}, endpointName)
if (resp?.data) { if (resp?.data) {
const d = resp.data.versions; const d = resp.data.Versions;
versions.apiApp = d.App?.split('+')[0] ?? '0.0.0'; versions.apiApp = d.App?.split('+')[0] ?? '0.0.0';
versions.apiSimApi = d.SimApi?.split('+')[0] ?? '0.0.0'; versions.apiSimApi = d.SimApi?.split('+')[0] ?? '0.0.0';
versions.apiAppFull = d.App ?? '0.0.0'; versions.apiAppFull = d.App ?? '0.0.0';
@@ -233,9 +233,9 @@ export class SimApiCore {
if (this.debug) { if (this.debug) {
console.log(`UI主应用版本: ${versions.uiApp}\nUISimApi版本: ${versions.uiSimApi}\nAPI主应用版本: ${versions.apiApp}\nAPISimApi版本: ${versions.apiSimApi}`) console.log(`UI主应用版本: ${versions.uiApp}\nUISimApi版本: ${versions.uiSimApi}\nAPI主应用版本: ${versions.apiApp}\nAPISimApi版本: ${versions.apiSimApi}`)
} }
resp.data.versions = versions; const conf = JSON.parse(JSON.stringify(resp.data));
this.webConfig.set(endpointName, resp.data); conf.Versions = versions;
this.webConfig.set(endpointName, conf);
} }
} }
return this.webConfig.get(endpointName)!; return this.webConfig.get(endpointName)!;
+1 -1
View File
@@ -76,7 +76,7 @@ export const useSimApi = defineStore('simapi', {
return this._core.getEndpoint(name) return this._core.getEndpoint(name)
}, },
async getConfig(reload = false, endpointName?: string): Promise<Map<string, object>> { async getConfig(reload = false, endpointName?: string): Promise<Record<string, object>> {
return this._core.getConfig(reload, endpointName) return this._core.getConfig(reload, endpointName)
}, },
}, },