Files
FileCodeBoxFronted/src/composables/usePublicConfigBootstrap.ts
T
2026-06-03 02:01:57 +08:00

26 lines
624 B
TypeScript

import { ConfigService } from '@/services'
import { useAlertStore } from '@/stores/alertStore'
import { useConfigStore } from '@/stores/configStore'
export function usePublicConfigBootstrap() {
const alertStore = useAlertStore()
const configStore = useConfigStore()
const syncPublicConfig = async () => {
const res = await ConfigService.getUserConfig()
if (res.code !== 200 || !res.detail) {
return
}
const notifyMessage = configStore.applyRemoteConfig(res.detail)
if (notifyMessage) {
alertStore.showAlert(notifyMessage, 'success')
}
}
return {
syncPublicConfig
}
}