Demo-Modus entfernt

isDemoMode war nie aktiv: appwrite.js hat immer eine Projekt-ID als
Fallback. Weg sind die Demo-Zweige in Anmeldung und Hooks sowie die
Beispieldaten aus der alten IT-Welt (Serverausfall, Drucker, Kunde A–E).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude Opus 5.5 committed 2026-09-27 14:36:33 +00:00
1 parent 889a2f42eb
commit b758b1f9a7
11 files changed
+25 -451

No files matched your search

-44
View File
@@ -4,7 +4,6 @@ import {
DATABASE_ID,
Query,
databases,
isDemoMode,
} from '../lib/appwrite'
import {
createCustomerWithPortalAccess,
@@ -13,26 +12,12 @@ import {
updateCustomerWithPortalAccess,
} from '../lib/customerAdminApi'
const DEMO_MODE = isDemoMode
// Demo-Kunden für Testing
const DEMO_CUSTOMERS = [
{ $id: '1', code: 'C001', name: 'Kunde A', location: 'Berlin', email: 'kunde.a@example.com', phone: '030-123456' },
{ $id: '2', code: 'C002', name: 'Kunde B', location: 'München', email: 'kunde.b@example.com', phone: '089-654321' }
]
export function useCustomers() {
const [customers, setCustomers] = useState([])
const [loading, setLoading] = useState(true)
const [error, setError] = useState(null)
const fetchCustomers = useCallback(async () => {
if (DEMO_MODE) {
setCustomers(DEMO_CUSTOMERS)
setLoading(false)
return
}
try {
try {
const response = await listCustomersForAdmin()
@@ -67,17 +52,6 @@ export function useCustomers() {
}, [fetchCustomers])
const createCustomer = async (data) => {
if (DEMO_MODE) {
const { password, ...rest } = data
const newCustomer = {
...rest,
portalPassword: password || rest.portalPassword || '',
$id: Date.now().toString(),
}
setCustomers(prev => [...prev, newCustomer])
return { success: true, data: newCustomer }
}
try {
const { password, ...fields } = data
const result = await createCustomerWithPortalAccess({ ...fields, password })
@@ -93,19 +67,6 @@ export function useCustomers() {
}
const updateCustomer = async (id, data) => {
if (DEMO_MODE) {
const { password, ...rest } = data
setCustomers(prev =>
prev.map(c => {
if (c.$id !== id) return c
const next = { ...c, ...rest }
if (password) next.portalPassword = password
return next
})
)
return { success: true }
}
try {
const { password, ...fields } = data
const payload = { ...fields }
@@ -135,11 +96,6 @@ export function useCustomers() {
}
const deleteCustomer = async (id) => {
if (DEMO_MODE) {
setCustomers(prev => prev.filter(c => c.$id !== id))
return { success: true }
}
try {
await deleteCustomerWithPortalAccess(id)
setCustomers(prev => prev.filter(c => c.$id !== id))