fix:提交缺失文件
This commit is contained in:
1 parent
8dc9266c14
commit
edf5b4530a
1 file changed
+23
@@ -0,0 +1,23 @@
|
||||
import { ref } from 'vue'
|
||||
import axios from 'axios'
|
||||
|
||||
const siteName = ref('')
|
||||
let fetched = false
|
||||
|
||||
async function fetchSiteName(): Promise<void> {
|
||||
if (fetched) return
|
||||
fetched = true
|
||||
try {
|
||||
const res = await axios.get('/api/settings/public', { timeout: 5000 })
|
||||
const settings = res.data?.data?.settings
|
||||
if (settings?.site_name) {
|
||||
siteName.value = settings.site_name
|
||||
}
|
||||
} catch {
|
||||
// silent — fallback to default
|
||||
}
|
||||
}
|
||||
|
||||
export function useSiteName() {
|
||||
return { siteName, fetchSiteName }
|
||||
}
|
||||
Reference in new issue
Block a user