This commit is contained in:
eric
2025-11-13 05:05:53 +08:00
parent cbdc65f56e
commit 891af61146
691 changed files with 83952 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
export class ResourceService {
async addResource(resource: { path: string }) {
// Logic to add the resource, e.g., sending a request to your API
const response = await fetch('/api/resource', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(resource),
});
if (!response.ok) {
throw new Error('Failed to add resource');
}
return await response.json(); // Return the response data if needed
}
}

View File

@@ -0,0 +1,43 @@
import { SiteConfig } from '@/types/site'
export class SiteConfigService {
async getSiteConfig(): Promise<SiteConfig> {
try {
const response = await fetch('/api/site')
if (!response.ok) throw new Error('Failed to fetch site config')
const data = await response.json()
return data
} catch (error) {
console.error('Error fetching site config:', error)
return {
basic: {
title: '',
description: '',
keywords: ''
},
appearance: {
logo: '',
favicon: '',
theme: 'system'
},
navigation: {
linkTarget: '_blank'
}
}
}
}
async updateSiteConfig(config: SiteConfig): Promise<boolean> {
try {
const response = await fetch('/api/site', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(config)
})
return response.ok
} catch (error) {
console.error('Error updating site config:', error)
return false
}
}
}