Team-API des Kundenportals und Oeffnen im neuen Tab ohne Pop-up-Sperre

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude Opus 5.5 committed 2026-10-01 19:39:15 +00:00
1 parent 52968b3017
commit 8c7a3fcced
3 files changed
+99

No files matched your search

+31
View File
@@ -0,0 +1,31 @@
import { account } from './appwrite'
import { createFinanceRequest } from './financeRequest'
/**
* Client fuer den Team-Eingang des Kundenportals (/api/team): alle Mitarbeiter, Appwrite-JWT (Bearer).
* Anfrage-Kern (JWT-Cache, Wiederholung bei 401, deutsche Fehlertexte) wie bei den Finanzen: financeRequest.js.
*/
const PROJECT_ADMIN_URL =
import.meta.env.VITE_PROJECT_ADMIN_URL || 'https://project.webklar.com'
const request = createFinanceRequest({ baseUrl: `${PROJECT_ADMIN_URL}/api/team`, createJWT: () => account.createJWT() })
const enc = encodeURIComponent
/** { hasAccess, lastLoginAt } */
export const getCustomerPortalStatus = (customerId) => request(`/customers/${enc(customerId)}/portal`)
/** { entries: [{ id, at, staffName, action, detail }] }, neueste zuerst */
export const getCustomerViewLog = (customerId) => request(`/customers/${enc(customerId)}/protokoll`)
/** Einmal-Link (60 s) in die Kundenansicht des Portals */
export async function createKundenansichtLink(customerId) {
const { openUrl } = await request(`/customers/${enc(customerId)}/kundenansicht`, { method: 'POST', body: {} })
return openUrl
}
/** Einmal-Link fuer die Preview eines Projekts */
export async function createPreviewLink({ subdomain, previewUrl }) {
const { openUrl } = await request('/preview-link', { method: 'POST', body: { subdomain, previewUrl } })
return openUrl
}