import {Dispatch} from "redux";
import axios, {AxiosError, AxiosResponse} from "axios";
import {getApiUrl, getJwtToken, successNotify} from "../../Util/config";
import {requestErrorsMessage} from "../../Util/requestErrorsMessage";
import {UserTelegramInjection} from "../../Model/UserTelegramInjection";
import {updateUserTelegramInjectionAction} from "../../Store/Auth/Actions";
import i18next from "i18next";

export interface GenerateTelegramSecretWordResponse {
    payload: {
        id: number,
        telegramInjections: UserTelegramInjection[],

            {
                headers: {
                    "Authorization": `Bearer ${getJwtToken()}`,
                },
            })
            .then((response: AxiosResponse) => {
                return response;
            })
            .then((json: AxiosResponse<GenerateTelegramSecretWordResponse>) => {
                if (json.data.payload) {

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

export default updateUserTelegramInjectionRequest;
