From 4eca55db24cc95b39539acf8f5ea701d0723a4ea Mon Sep 17 00:00:00 2001 From: Alexander Schmidt Date: Sun, 1 Feb 2026 14:17:06 +0100 Subject: [PATCH] delete obsolete api.js, update README --- README.md | 6 +- js/services/api.js | 138 --------------------------------------------- 2 files changed, 3 insertions(+), 141 deletions(-) delete mode 100644 js/services/api.js diff --git a/README.md b/README.md index 4df68c0..63822d6 100644 --- a/README.md +++ b/README.md @@ -187,9 +187,9 @@ dgray/ - Self-hosted Fonts (SIL Open Font License) ### Farbpalette -- **Light Mode**: Lavender-Töne (#FAF8FC, #6B5B95) -- **Dark Mode**: Deep Purple (#1A1424, #B8A5D6) -- WCAG AAA konform (Kontrast > 7:1) +- **Monochrome Theme** - reine Graustufen +- **Light Mode**: BG #FAFAFA, Text #1A1A1A, Primary #555555 +- **Dark Mode**: BG #141414, Text #F0F0F0, Primary #AAAAAA ### Mobile-First - Responsive Grid (2 Spalten Mobile, 5 Spalten Desktop) diff --git a/js/services/api.js b/js/services/api.js deleted file mode 100644 index 08cd47f..0000000 --- a/js/services/api.js +++ /dev/null @@ -1,138 +0,0 @@ -const API_BASE_URL = '/api' - -class ApiService { - constructor() { - this.baseUrl = API_BASE_URL - this.token = null - } - - setToken(token) { - this.token = token - } - - clearToken() { - this.token = null - } - - async request(endpoint, options = {}) { - const url = `${this.baseUrl}${endpoint}` - - const headers = { - 'Content-Type': 'application/json', - ...options.headers - } - - if (this.token) { - headers['Authorization'] = `Bearer ${this.token}` - } - - try { - const response = await fetch(url, { - ...options, - headers - }) - - if (!response.ok) { - const error = await response.json().catch(() => ({})) - throw new ApiError(response.status, error.message || 'Request failed', error) - } - - if (response.status === 204) { - return null - } - - return await response.json() - } catch (error) { - if (error instanceof ApiError) throw error - throw new ApiError(0, 'Network error', { originalError: error }) - } - } - - async get(endpoint, params = {}) { - const queryString = new URLSearchParams(params).toString() - const url = queryString ? `${endpoint}?${queryString}` : endpoint - return this.request(url, { method: 'GET' }) - } - - async post(endpoint, data) { - return this.request(endpoint, { - method: 'POST', - body: JSON.stringify(data) - }) - } - - async put(endpoint, data) { - return this.request(endpoint, { - method: 'PUT', - body: JSON.stringify(data) - }) - } - - async patch(endpoint, data) { - return this.request(endpoint, { - method: 'PATCH', - body: JSON.stringify(data) - }) - } - - async delete(endpoint) { - return this.request(endpoint, { method: 'DELETE' }) - } - - async getListings(params = {}) { - return this.get('/items/listings', params) - } - - async getListing(id) { - return this.get(`/items/listings/${id}`) - } - - async createListing(data) { - return this.post('/items/listings', data) - } - - async updateListing(id, data) { - return this.patch(`/items/listings/${id}`, data) - } - - async deleteListing(id) { - return this.delete(`/items/listings/${id}`) - } - - async searchListings(query, params = {}) { - return this.get('/items/listings', { search: query, ...params }) - } - - async getCategories() { - return this.get('/items/categories') - } - - async uploadFile(file) { - const formData = new FormData() - formData.append('file', file) - - const response = await fetch(`${this.baseUrl}/files`, { - method: 'POST', - headers: this.token ? { 'Authorization': `Bearer ${this.token}` } : {}, - body: formData - }) - - if (!response.ok) { - throw new ApiError(response.status, 'Upload failed') - } - - return response.json() - } -} - -class ApiError extends Error { - constructor(status, message, data = {}) { - super(message) - this.name = 'ApiError' - this.status = status - this.data = data - } -} - -export const api = new ApiService() -export { ApiError }