import axios, {AxiosError, AxiosResponse} from "axios";
import {getApiUrl, getJwtToken, successNotify} from "../../Util/config";
import {requestErrorsMessage} from "../../Util/requestErrorsMessage";
import i18next from "i18next";

export interface SendTelegramMessageRequestResponse {
    success: boolean,
}

const sendTelegramMessageRequest = (message: string) => {
    axios.post<SendTelegramMessageRequestResponse>(getApiUrl("accounts/sendTelegramMessage"),
        {
            message: message,
        },
        {
            headers: {

        })
        .catch((error: Error | AxiosError) => {
            requestErrorsMessage(error, i18next.t("TELEGRAM_MESSAGE_SEND_ERROR"));
        });
};

export default sendTelegramMessageRequest;
