Skip to main content

unsubscribe-list

unsubscribe method​

  • Unsubscribe is used to log out of the system by removing the user's email from the subscription list and no longer receiving updates.

  • sendQueries method exports the sendQueries method which takes email , category and message as parameters.

  • ​Returns the status of the query, which may be successful or failed, data is the response data of the query, error is the error message in case of an error, isLoading is the flag for the status of the query, and submitQueryMethod is the callback method that may be called when the button is clicked.

handleUnsubscribeCustomer method​

  • handleUnsubscribeCustomer method is used to unsubscribe users from the list. It takes email as a parameter.

  • Returns the status of the query, which may be successful or failed, data is the response data of the query, error is the error message in case of an error, isLoading is the flag for the status of the query, and submitQueryMethod is the callback method that may be called when the button is clicked.

handleSubmitUnsubscribeReason method​

  • handleSubmitUnsubscribeReason method used for submitting the reason for unsubscribing from list it takes reason as param.

  • it returns status which is the status of request which can be one of success or failure, data is the response data of request, error is the error message in case of error, isLoading is the flag for status of request, and submitReason is the callBack method which can be called on button click.

handleSubscribeAgain method​

  • handleSubscribeAgain method used for subscribing the user again to the system.

  • Returns the status of the query, which may be successful or failed, data is the response data of the query, error is the error message in case of an error, isLoading is the flag for the status of the query, and subscribeAgain is the callback method that may be called when the button is clicked.

unsubscribe queries
import React from "react";
import { MetastaqInstance } from "./MetastaqInstance";

export const ShowUnsubscribeQuery = () => {
const { unsubscribe } = MetastaqInstance;

const {
handleUnsubscribeCustomer,
handleSubmitUnsubscribeReason,
handleSubscribeAgain,
} = unsubscribe({ clientId, email });

const { status, data, error, isFetching, isLoading, submitQueryMethod } =
handleUnsubscribeCustomer(email);

const { status, data, error, isFetching, isLoading, submitReason } =
handleSubmitUnsubscribeReason(reason);

const { status, data, error, isFetching, isLoading, subscribeAgain } =
handleSubscribeAgain();

return (
<div>
<button
onClick={() => {
submitQueryMethod();
}}
>
Submit your question
</button>

<button
onClick={() => {
submitReason();
}}
>
Submit reason
</button>

<button
onClick={() => {
subscribeAgain();
}}
>
Subscribe Again
</button>
</div>
);
};