32 lines
780 B
TypeScript
32 lines
780 B
TypeScript
import { apiRequest } from '../lib/api'
|
|
import { getActiveBusinessId } from '../lib/businessContext'
|
|
|
|
export interface WebsiteSitemapConfig {
|
|
baseUrl?: string | null
|
|
staticPages?: Array<{
|
|
path: string
|
|
changefreq?: string
|
|
priority?: number
|
|
}>
|
|
templates?: Record<string, string>
|
|
syncedAt?: string | null
|
|
}
|
|
|
|
function businessPath(suffix: string) {
|
|
const businessId = getActiveBusinessId()
|
|
if (!businessId) {
|
|
throw new Error('No active business selected. Please sign in again.')
|
|
}
|
|
return `/businesses/${businessId}/website/sitemap${suffix}`
|
|
}
|
|
|
|
export async function syncWebsiteSitemapConfig() {
|
|
return apiRequest<{
|
|
message: string
|
|
sitemapConfig: WebsiteSitemapConfig
|
|
}>(businessPath('/sync'), {
|
|
method: 'POST',
|
|
auth: true,
|
|
})
|
|
}
|