- Tabelle -> responsives Karten-Grid (kein Excel-Look), Typ-Badges - Bearbeiten (Stift): Name, Subdomain, Typ (Preview/Oeffentliche Website/Internes Projekt) -> PATCH synct Git + Preview + Appwrite - Repository im Bearbeiten-Modus archivieren/reaktivieren - Dropdown-Filter Archiviert; archivierte Projekte standardmaessig ausgeblendet Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
53 lines
1.5 KiB
JavaScript
53 lines
1.5 KiB
JavaScript
import { account } from './appwrite'
|
|
|
|
const PROJECT_ADMIN_URL =
|
|
import.meta.env.VITE_PROJECT_ADMIN_URL || 'https://project.webklar.com'
|
|
|
|
async function adminFetch(path, options = {}) {
|
|
const jwt = await account.createJWT()
|
|
const response = await fetch(`${PROJECT_ADMIN_URL}${path}`, {
|
|
...options,
|
|
headers: {
|
|
Authorization: `Bearer ${jwt.jwt}`,
|
|
'Content-Type': 'application/json',
|
|
...options.headers,
|
|
},
|
|
})
|
|
const data = await response.json().catch(() => ({}))
|
|
if (!response.ok) throw new Error(data.error || `API-Fehler ${response.status}`)
|
|
return data
|
|
}
|
|
|
|
export async function createProjectFromTemplate(payload) {
|
|
return adminFetch('/api/admin/website-projects/create-from-template', {
|
|
method: 'POST',
|
|
body: JSON.stringify(payload),
|
|
})
|
|
}
|
|
|
|
export async function syncGiteaRepos() {
|
|
return adminFetch('/api/admin/gitea/sync-repos', { method: 'POST' })
|
|
}
|
|
|
|
export async function updateWebsiteProject(id, payload) {
|
|
return adminFetch(`/api/admin/website-projects/${id}`, {
|
|
method: 'PATCH',
|
|
body: JSON.stringify(payload),
|
|
})
|
|
}
|
|
|
|
export async function archiveWebsiteProject(id) {
|
|
return adminFetch(`/api/admin/website-projects/${id}/archive`, { method: 'POST' })
|
|
}
|
|
|
|
export async function unarchiveWebsiteProject(id) {
|
|
return adminFetch(`/api/admin/website-projects/${id}/unarchive`, { method: 'POST' })
|
|
}
|
|
|
|
export async function fetchProjectReadme(repoFullName) {
|
|
if (!repoFullName) return { found: false }
|
|
return adminFetch(
|
|
`/api/admin/gitea/repo-readme?repoFullName=${encodeURIComponent(repoFullName)}`
|
|
)
|
|
}
|