mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-29 16:03:21 +00:00
36 lines
971 B
JavaScript
36 lines
971 B
JavaScript
import { BE_SETTINGS_SMTP_URL } from '@/utils/Url';
|
|
import { errorHandler, requestResponseHandler } from './actionsHandlers';
|
|
|
|
export const PENDING = 'pending';
|
|
export const SUBSCRIBED = 'subscribed';
|
|
export const ARCHIVED = 'archived';
|
|
|
|
export const fetchSmtpSettings = (csrfToken, establishment_id = null) => {
|
|
let url = `${BE_SETTINGS_SMTP_URL}/`;
|
|
if (establishment_id) {
|
|
url += `?establishment_id=${establishment_id}`;
|
|
}
|
|
return fetch(`${url}`, {
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
'X-CSRFToken': csrfToken,
|
|
},
|
|
})
|
|
.then(requestResponseHandler)
|
|
.catch(errorHandler);
|
|
};
|
|
|
|
export const editSmtpSettings = (data, csrfToken) => {
|
|
return fetch(`${BE_SETTINGS_SMTP_URL}/`, {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
'X-CSRFToken': csrfToken,
|
|
},
|
|
body: JSON.stringify(data),
|
|
credentials: 'include',
|
|
})
|
|
.then(requestResponseHandler)
|
|
.catch(errorHandler);
|
|
};
|