admin_ruspet/src/api/telegramManagers.ts

30 lines
1005 B
TypeScript

import axios from 'axios'
// Изолированный клиент ТОЛЬКО для сервера менеджеров
const managerApiClient = axios.create({
baseURL: 'https://37.252.5.229.nip.io/tg-api/api',
headers: {
'Content-Type': 'application/json',
'X-API-Key': 'supersecretkey',
},
})
export const telegramManagersApi = {
getStatus: () =>
managerApiClient.get('/managers/status'),
sendCode: (phone: string, name: string) =>
managerApiClient.post('/managers/auth/send-code', { phone, name }),
verifyCode: (phone: string, code: string, password?: string) =>
managerApiClient.post('/managers/auth/verify-code', { phone, code, password }),
delete: (managerId: number) =>
managerApiClient.delete(`/managers/${managerId}`),
startQr: () =>
managerApiClient.post('/managers/auth/qr/start'),
checkQrStatus: (token: string) =>
managerApiClient.get(`/managers/auth/qr/status?token=${token}`),
}