Files
DLE/frontend/src/services/systemMessagesService.js
2025-11-12 13:38:12 +03:00

56 lines
1.4 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* Сервис для работы с системными сообщениями
*/
import api from '../api/axios';
const BASE_URL = '/system-messages';
export default {
async getSystemMessages(params = {}) {
const response = await api.get(BASE_URL, { params });
return response.data;
},
async getPublishedSystemMessages(params = {}) {
const response = await api.get(`${BASE_URL}/published`, { params });
return response.data;
},
async getSystemMessage(id) {
const response = await api.get(`${BASE_URL}/${id}`);
return response.data;
},
async createSystemMessage(payload) {
const response = await api.post(BASE_URL, payload);
return response.data;
},
async updateSystemMessage(id, payload) {
const response = await api.patch(`${BASE_URL}/${id}`, payload);
return response.data;
},
async deleteSystemMessage(id) {
const response = await api.delete(`${BASE_URL}/${id}`);
return response.data;
},
async bulkPublish(ids) {
const response = await api.post(`${BASE_URL}/bulk/publish`, { ids });
return response.data;
},
async bulkUnpublish(ids) {
const response = await api.post(`${BASE_URL}/bulk/unpublish`, { ids });
return response.data;
},
async bulkDelete(ids) {
const response = await api.post(`${BASE_URL}/bulk/delete`, { ids });
return response.data;
}
};