Развитие бека
1. Создание БД 2. Создание бека 3. Пока создали класс юзера
This commit is contained in:
@@ -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' })
|
||||
}
|
||||
Reference in New Issue
Block a user