Gitea-Projektintegration im Ticket-Frontend dauerhaft einbinden.
Projekt-Zuweisung, README-Anzeige und Admin-API-Hooks ins Repo committen, damit deploy.sh die Änderungen nicht mehr verwirft. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -3,20 +3,35 @@ import { account } from './appwrite'
|
||||
const PROJECT_ADMIN_URL =
|
||||
import.meta.env.VITE_PROJECT_ADMIN_URL || 'https://project.webklar.com'
|
||||
|
||||
export async function createProjectFromTemplate(payload) {
|
||||
async function adminFetch(path, options = {}) {
|
||||
const jwt = await account.createJWT()
|
||||
const response = await fetch(
|
||||
`${PROJECT_ADMIN_URL}/api/admin/website-projects/create-from-template`,
|
||||
{
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Authorization: `Bearer ${jwt.jwt}`,
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(payload),
|
||||
}
|
||||
)
|
||||
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 fetchProjectReadme(repoFullName) {
|
||||
if (!repoFullName) return { found: false }
|
||||
return adminFetch(
|
||||
`/api/admin/gitea/repo-readme?repoFullName=${encodeURIComponent(repoFullName)}`
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user