ваше сообщение коммита
This commit is contained in:
@@ -18,7 +18,7 @@ const updateIdentities = async () => {
|
||||
if (!isAuthenticated.value || !userId.value) return;
|
||||
|
||||
try {
|
||||
const response = await axios.get('/api/auth/identities');
|
||||
const response = await axios.get('/auth/identities');
|
||||
if (response.data.success) {
|
||||
// Фильтруем идентификаторы: убираем гостевые и оставляем только уникальные
|
||||
const filteredIdentities = response.data.identities
|
||||
@@ -71,7 +71,7 @@ const stopIdentitiesPolling = () => {
|
||||
|
||||
const checkTokenBalances = async (address) => {
|
||||
try {
|
||||
const response = await axios.get(`/api/auth/check-tokens/${address}`);
|
||||
const response = await axios.get(`/auth/check-tokens/${address}`);
|
||||
if (response.data.success) {
|
||||
tokenBalances.value = response.data.balances;
|
||||
return response.data.balances;
|
||||
@@ -194,7 +194,7 @@ const linkMessages = async () => {
|
||||
/* Удаляем ненужный вызов
|
||||
try {
|
||||
// Отправляем запрос на связывание сообщений
|
||||
const response = await axios.post('/api/auth/link-guest-messages', identifiersData);
|
||||
const response = await axios.post('/auth/link-guest-messages', identifiersData);
|
||||
|
||||
if (response.data.success) {
|
||||
console.log('Messages linked successfully:', response.data);
|
||||
@@ -257,7 +257,7 @@ const linkMessages = async () => {
|
||||
|
||||
const checkAuth = async () => {
|
||||
try {
|
||||
const response = await axios.get('/api/auth/check');
|
||||
const response = await axios.get('/auth/check');
|
||||
console.log('Auth check response:', response.data);
|
||||
|
||||
const wasAuthenticated = isAuthenticated.value;
|
||||
@@ -315,7 +315,7 @@ const checkAuth = async () => {
|
||||
const disconnect = async () => {
|
||||
try {
|
||||
// Удаляем все идентификаторы перед выходом
|
||||
await axios.post('/api/auth/logout');
|
||||
await axios.post('/auth/logout');
|
||||
|
||||
// Обновляем состояние в памяти
|
||||
updateAuth({
|
||||
@@ -423,7 +423,7 @@ const updateConnectionDisplay = (isConnected, authType, authData = {}) => {
|
||||
* @returns {Promise<Object>} - Результат операции
|
||||
*/
|
||||
const linkIdentity = async (type, value) => {
|
||||
const response = await axios.post('/api/link', {
|
||||
const response = await axios.post('/link', {
|
||||
type,
|
||||
value,
|
||||
});
|
||||
@@ -437,7 +437,7 @@ const linkIdentity = async (type, value) => {
|
||||
* @returns {Promise<Object>} - Результат операции
|
||||
*/
|
||||
const deleteIdentity = async (provider, providerId) => {
|
||||
const response = await axios.delete(`/api/${provider}/${encodeURIComponent(providerId)}`);
|
||||
const response = await axios.delete(`/${provider}/${encodeURIComponent(providerId)}`);
|
||||
return response.data;
|
||||
};
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ export function useAuthFlow(options = {}) {
|
||||
telegramAuth.value.isLoading = true;
|
||||
telegramAuth.value.error = '';
|
||||
try {
|
||||
const response = await api.post('/api/auth/telegram/init');
|
||||
const response = await api.post('/auth/telegram/init');
|
||||
if (response.data.success) {
|
||||
telegramAuth.value.verificationCode = response.data.verificationCode;
|
||||
telegramAuth.value.botLink = response.data.botLink;
|
||||
@@ -130,7 +130,7 @@ export function useAuthFlow(options = {}) {
|
||||
emailAuth.value.isLoading = true;
|
||||
|
||||
try {
|
||||
const response = await api.post('/api/auth/email/init', { email: emailAuth.value.email });
|
||||
const response = await api.post('/auth/email/init', { email: emailAuth.value.email });
|
||||
if (response.data.success) {
|
||||
emailAuth.value.verificationEmail = emailAuth.value.email; // Сохраняем email
|
||||
emailAuth.value.showForm = false;
|
||||
@@ -161,7 +161,7 @@ export function useAuthFlow(options = {}) {
|
||||
emailAuth.value.isVerifying = true;
|
||||
|
||||
try {
|
||||
const response = await api.post('/api/auth/email/verify-code', {
|
||||
const response = await api.post('/auth/email/verify-code', {
|
||||
email: emailAuth.value.verificationEmail,
|
||||
code: emailAuth.value.verificationCode,
|
||||
});
|
||||
|
||||
@@ -14,7 +14,7 @@ export default function useBlockchainNetworks() {
|
||||
const fetchNetworks = async () => {
|
||||
loadingNetworks.value = true;
|
||||
try {
|
||||
const { data } = await axios.get('/api/settings/rpc');
|
||||
const { data } = await axios.get('/settings/rpc');
|
||||
const networksArr = data.data || [];
|
||||
networks.value = networksArr.map(n => ({
|
||||
value: n.network_id,
|
||||
@@ -163,7 +163,7 @@ export default function useBlockchainNetworks() {
|
||||
|
||||
try {
|
||||
// Формируем запрос на бэкенд для проверки RPC
|
||||
const response = await axios.post('/api/settings/rpc-test', {
|
||||
const response = await axios.post('/settings/rpc-test', {
|
||||
networkId,
|
||||
rpcUrl
|
||||
});
|
||||
|
||||
@@ -80,7 +80,7 @@ export function useChat(auth) {
|
||||
let totalMessages = -1;
|
||||
if (initial || messageLoading.value.offset === 0) {
|
||||
try {
|
||||
const countResponse = await api.get('/api/chat/history', { params: { count_only: true } });
|
||||
const countResponse = await api.get('/chat/history', { params: { count_only: true } });
|
||||
if (!countResponse.data.success) throw new Error('Не удалось получить количество сообщений');
|
||||
totalMessages = countResponse.data.total || countResponse.data.count || 0;
|
||||
console.log(`[useChat] Всего сообщений в истории: ${totalMessages}`);
|
||||
@@ -97,7 +97,7 @@ export function useChat(auth) {
|
||||
console.log(`[useChat] Рассчитано начальное смещение: ${effectiveOffset}`);
|
||||
}
|
||||
|
||||
const response = await api.get('/api/chat/history', {
|
||||
const response = await api.get('/chat/history', {
|
||||
params: {
|
||||
offset: effectiveOffset,
|
||||
limit: messageLoading.value.limit,
|
||||
@@ -225,14 +225,14 @@ export function useChat(auth) {
|
||||
});
|
||||
}
|
||||
|
||||
let apiUrl = '/api/chat/message';
|
||||
let apiUrl = '/chat/message';
|
||||
if (isGuestMessage) {
|
||||
if (!guestId.value) {
|
||||
guestId.value = initGuestId();
|
||||
setToStorage('guestId', guestId.value);
|
||||
}
|
||||
formData.append('guestId', guestId.value);
|
||||
apiUrl = '/api/chat/guest-message';
|
||||
apiUrl = '/chat/guest-message';
|
||||
}
|
||||
|
||||
const response = await api.post(apiUrl, formData, {
|
||||
@@ -352,7 +352,7 @@ export function useChat(auth) {
|
||||
const linkGuestMessagesAfterAuth = async () => {
|
||||
if (!guestId.value) return;
|
||||
try {
|
||||
const response = await api.post('/api/chat/process-guest', { guestId: guestId.value });
|
||||
const response = await api.post('/chat/process-guest', { guestId: guestId.value });
|
||||
if (response.data.success && response.data.conversationId) {
|
||||
// Можно сразу загрузить историю по этому диалогу, если нужно
|
||||
await loadMessages({ initial: true });
|
||||
|
||||
@@ -42,7 +42,7 @@ export function useContactsAndMessagesWebSocket() {
|
||||
|
||||
async function fetchContactsReadStatus() {
|
||||
try {
|
||||
const { data } = await axios.get('/api/users/read-contacts-status');
|
||||
const { data } = await axios.get('/users/read-contacts-status');
|
||||
readContacts.value = data || [];
|
||||
} catch (e) {
|
||||
readContacts.value = [];
|
||||
@@ -60,7 +60,7 @@ export function useContactsAndMessagesWebSocket() {
|
||||
|
||||
async function markContactAsRead(contactId) {
|
||||
try {
|
||||
await axios.post('/api/users/mark-contact-read', { contactId });
|
||||
await axios.post('/users/mark-contact-read', { contactId });
|
||||
if (!readContacts.value.includes(contactId)) {
|
||||
readContacts.value.push(contactId);
|
||||
updateNewContacts();
|
||||
@@ -70,7 +70,7 @@ export function useContactsAndMessagesWebSocket() {
|
||||
|
||||
async function fetchReadStatus() {
|
||||
try {
|
||||
const { data } = await axios.get('/api/messages/read-status');
|
||||
const { data } = await axios.get('/messages/read-status');
|
||||
lastReadMessageDate.value = data || {};
|
||||
} catch (e) {
|
||||
lastReadMessageDate.value = {};
|
||||
@@ -97,7 +97,7 @@ export function useContactsAndMessagesWebSocket() {
|
||||
const maxDate = Math.max(...userMessages.map(m => new Date(m.created_at).getTime()));
|
||||
const maxDateISO = new Date(maxDate).toISOString();
|
||||
try {
|
||||
await axios.post('/api/messages/mark-read', { userId, lastReadAt: maxDateISO });
|
||||
await axios.post('/messages/mark-read', { userId, lastReadAt: maxDateISO });
|
||||
lastReadMessageDate.value[userId] = maxDateISO;
|
||||
} catch (e) {}
|
||||
}
|
||||
@@ -114,7 +114,8 @@ export function useContactsAndMessagesWebSocket() {
|
||||
}
|
||||
|
||||
function setupWebSocket() {
|
||||
ws = new WebSocket('ws://localhost:8000');
|
||||
const wsProtocol = window.location.protocol === 'https:' ? 'wss' : 'ws';
|
||||
ws = new WebSocket(`${wsProtocol}://${window.location.host}/ws`);
|
||||
ws.onmessage = (event) => {
|
||||
const data = JSON.parse(event.data);
|
||||
if (data.type === 'contacts-updated') {
|
||||
|
||||
Reference in New Issue
Block a user