import CustomFetch from '@/Utils/APIRequest/AxiosInstance';
import { CometChatNotificationAPI } from '@/Utils/APIRequest/Endpoints';

/** Tell the backend to clear CometChat unread for the other person on this campaign. */
export const notifyCometChatRead = (payload: {
    campaign_id?: string | number | null;
    sender_id?: string | number | null;
}) => {
    const campaign_id = payload?.campaign_id;
    const sender_id = payload?.sender_id;
    if (campaign_id == null || campaign_id === '' || sender_id == null || sender_id === '') return;   

    CustomFetch(
        {
            url: CometChatNotificationAPI,
            method: 'post',
            data: { campaign_id, sender_id },
        },
        null,
        false,
        false
    );
};
