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 takesemail
,category
andmessage
as parameters.βReturns the
status
of the query, which may be successful or failed, data is the responsedata
of the query,error
is the error message in case of an error,isLoading
is the flag for the status of the query, andsubmitQueryMethod
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 takesemail
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, andsubmitQueryMethod
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 takesreason
as param.it returns
status
which is the status of request which can be one ofsuccess
orfailure
,data
is the response data of request,error
is the error message in case of error,isLoading
is the flag for status of request, andsubmitReason
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, andsubscribeAgain
is the callback method that may be called when the button is clicked.
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>
);
};