Implementiere Kundenportal mit zentraler Appwrite-Anbindung.
Express-Server für Appwrite-Auth, Session, Projekt-Dashboard und Gitea-Webhook; statisches Frontend und Schema-Dokumentation für woms-database. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
24
server/services/appwriteClient.js
Normal file
24
server/services/appwriteClient.js
Normal file
@@ -0,0 +1,24 @@
|
||||
import { createUserClient } from './appwriteAdmin.js'
|
||||
|
||||
export async function loginWithAppwrite(email, password) {
|
||||
const { client, account } = createUserClient()
|
||||
|
||||
try {
|
||||
await account.createEmailPasswordSession(email, password)
|
||||
} catch (err) {
|
||||
const message = err?.message || 'Anmeldung fehlgeschlagen'
|
||||
const error = new Error(message)
|
||||
error.status = 401
|
||||
throw error
|
||||
}
|
||||
|
||||
const user = await account.get()
|
||||
|
||||
try {
|
||||
await account.deleteSession('current')
|
||||
} catch {
|
||||
// Portal nutzt eigene Session; Appwrite-Session wird nicht persistiert
|
||||
}
|
||||
|
||||
return user
|
||||
}
|
||||
Reference in New Issue
Block a user