PromoCodes

This commit is contained in:
rafael1209
2024-02-22 18:50:45 +02:00
parent 8d2202c393
commit b253f16855
2 changed files with 79 additions and 10 deletions

View File

@@ -74,4 +74,31 @@ export async function GetChatHistory() {
}
}
export async function ApplyPromoCode(authToken, searchToken, promoCode) {
const data = {
userCredentials: {
searchToken: searchToken,
authtoken: authToken
},
promoCode: promoCode
};
try {
const response = await fetch(`${BackendApiUrl}/PromoCode/ApplyPromo`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(data),
redirect: "follow"
});
if (!response.ok) {
console.log("Fetch error:", response.status);
}
return await response.json();
} catch (error) {
console.log("Fetch error:", error);
}
}