1
0

Развитие бека

1. Создание БД
2. Создание бека
3. Пока создали класс юзера
This commit is contained in:
2026-01-11 17:48:05 +07:00
parent 301e179160
commit a9c146b192
9 changed files with 351 additions and 15 deletions

View File

@@ -9,14 +9,24 @@ const request = async (endpoint, options = {}) => {
// ==================== AUTH ====================
export const authApi = {
login: (data) => request('/auth', {
login: (username, password) => request('/api/user', {
method: 'POST',
credentials: 'include',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data)
body: JSON.stringify({ action: 'auth_login', username, password })
}),
check: () => request('/check-auth', { credentials: 'include' }),
logout: () => request('/logout', { credentials: 'include' })
check: () => request('/api/user', {
method: 'POST',
credentials: 'include',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ action: 'check_session' })
}),
logout: () => request('/api/user', {
method: 'POST',
credentials: 'include',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ action: 'logout' })
})
}
// ==================== DEPARTMENTS ====================
@@ -57,5 +67,5 @@ export const cardsApi = {
// ==================== USERS ====================
export const usersApi = {
getAll: () => request('/users', { credentials: 'include' })
getAll: () => request('/api/user', { credentials: 'include' })
}