ваше сообщение коммита
This commit is contained in:
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user