ваше сообщение коммита
This commit is contained in:
@@ -31,6 +31,12 @@ export default {
|
||||
return res.data;
|
||||
} catch (err) {
|
||||
console.error('Ошибка при удалении контакта:', err.response?.status, err.response?.data, err);
|
||||
|
||||
// Если пользователь уже удален (404), считаем это успехом
|
||||
if (err.response?.status === 404) {
|
||||
return { success: true, deleted: 0, message: 'Пользователь уже удален' };
|
||||
}
|
||||
|
||||
throw err;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
* GitHub: https://github.com/HB3-ACCELERATOR
|
||||
*/
|
||||
|
||||
import axios from 'axios';
|
||||
import api from '@/api/axios';
|
||||
|
||||
/**
|
||||
* Сервис для работы с DLE v2 (Digital Legal Entity)
|
||||
@@ -24,7 +24,7 @@ class DLEV2Service {
|
||||
*/
|
||||
async createDLE(dleParams) {
|
||||
try {
|
||||
const response = await axios.post('/api/dle-v2', dleParams);
|
||||
const response = await api.post('/dle-v2', dleParams);
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
console.error('Ошибка при создании DLE v2:', error);
|
||||
@@ -38,7 +38,7 @@ class DLEV2Service {
|
||||
*/
|
||||
async getAllDLEs() {
|
||||
try {
|
||||
const response = await axios.get('/api/dle-v2');
|
||||
const response = await api.get('/dle-v2');
|
||||
return response.data.data || [];
|
||||
} catch (error) {
|
||||
console.error('Ошибка при получении списка DLE v2:', error);
|
||||
@@ -52,7 +52,7 @@ class DLEV2Service {
|
||||
*/
|
||||
async getDefaults() {
|
||||
try {
|
||||
const response = await axios.get('/api/dle-v2/defaults');
|
||||
const response = await api.get('/dle-v2/defaults');
|
||||
return response.data.data;
|
||||
} catch (error) {
|
||||
console.error('Ошибка при получении настроек по умолчанию DLE v2:', error);
|
||||
@@ -73,7 +73,7 @@ class DLEV2Service {
|
||||
*/
|
||||
async deleteDLE(dleAddress) {
|
||||
try {
|
||||
const response = await axios.delete(`/api/dle-v2/${dleAddress}`);
|
||||
const response = await api.delete(`/dle-v2/${dleAddress}`);
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
console.error('Ошибка при удалении DLE v2:', error);
|
||||
|
||||
@@ -10,12 +10,12 @@
|
||||
* GitHub: https://github.com/HB3-ACCELERATOR
|
||||
*/
|
||||
|
||||
import axios from 'axios';
|
||||
import api from '@/api/axios';
|
||||
|
||||
export default {
|
||||
async getMessagesByUserId(userId) {
|
||||
if (!userId) return [];
|
||||
const { data } = await axios.get(`/messages?userId=${userId}`);
|
||||
const { data } = await api.get(`/messages?userId=${userId}`);
|
||||
return data;
|
||||
},
|
||||
async sendMessage({ conversationId, message, attachments = [], toUserId }) {
|
||||
@@ -26,7 +26,7 @@ export default {
|
||||
attachments.forEach(file => {
|
||||
formData.append('attachments', file);
|
||||
});
|
||||
const { data } = await axios.post('/chat/message', formData, {
|
||||
const { data } = await api.post('/chat/message', formData, {
|
||||
headers: { 'Content-Type': 'multipart/form-data' },
|
||||
withCredentials: true
|
||||
});
|
||||
@@ -34,20 +34,20 @@ export default {
|
||||
},
|
||||
async getMessagesByConversationId(conversationId) {
|
||||
if (!conversationId) return [];
|
||||
const { data } = await axios.get(`/messages?conversationId=${conversationId}`);
|
||||
const { data } = await api.get(`/messages?conversationId=${conversationId}`);
|
||||
return data;
|
||||
},
|
||||
async getConversationByUserId(userId) {
|
||||
if (!userId) return null;
|
||||
const { data } = await axios.get(`/messages/conversations?userId=${userId}`);
|
||||
const { data } = await api.get(`/messages/conversations?userId=${userId}`);
|
||||
return data;
|
||||
},
|
||||
async generateAiDraft(conversationId, messages, language = 'auto') {
|
||||
const { data } = await axios.post('/chat/ai-draft', { conversationId, messages, language });
|
||||
const { data } = await api.post('/chat/ai-draft', { conversationId, messages, language });
|
||||
return data;
|
||||
},
|
||||
async broadcastMessage({ userId, message }) {
|
||||
const { data } = await axios.post('/messages/broadcast', {
|
||||
const { data } = await api.post('/messages/broadcast', {
|
||||
user_id: userId,
|
||||
content: message
|
||||
}, {
|
||||
@@ -56,7 +56,7 @@ export default {
|
||||
return data;
|
||||
},
|
||||
async deleteMessagesHistory(userId) {
|
||||
const { data } = await axios.delete(`/messages/history/${userId}`, {
|
||||
const { data } = await api.delete(`/messages/history/${userId}`, {
|
||||
withCredentials: true
|
||||
});
|
||||
return data;
|
||||
@@ -64,6 +64,6 @@ export default {
|
||||
};
|
||||
|
||||
export async function getAllMessages() {
|
||||
const { data } = await axios.get('/messages');
|
||||
const { data } = await api.get('/messages');
|
||||
return data;
|
||||
}
|
||||
@@ -139,7 +139,7 @@ class WebSocketService {
|
||||
break;
|
||||
|
||||
case 'tags-updated':
|
||||
console.log('🏷️ [WebSocket] Обновление тегов клиентов');
|
||||
console.log('🔔 [websocketService] Получено сообщение tags-updated');
|
||||
this.emit('tags-updated');
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user