This commit is contained in:
zadit frontend
2024-10-04 04:09:17 +00:00
parent a86aaef4f6
commit aec707c714
13 changed files with 215 additions and 283 deletions

View File

@@ -24,22 +24,25 @@ export async function getCafe(cafeId) {
}
}
// api.js
export const saveWelcomePageConfig = async (details) => {
export const saveWelcomePageConfig = async (cafeId, details) => {
const formData = new FormData();
// Append image file if it exists
if (details.image) {
const blob = await fetch(details.image).then((res) => res.blob());
formData.append("image", blob, "welcome-image.png"); // Specify filename if needed
formData.append("cafeLogo", blob, "welcome-image.png"); // Specify filename if needed
}
// Append other form fields
formData.append("welcomingText", details.welcomingText);
formData.append("backgroundColor", details.backgroundColor);
formData.append("textColor", details.textColor);
// Append the isWelcomePageActive field
formData.append("isWelcomePageActive", details.isWelcomePageActive);
try {
const response = await fetch(`${API_BASE_URL}/welcome-config`, {
const response = await fetch(`${API_BASE_URL}/cafe/welcome-config/${cafeId}`, {
method: "POST",
headers: {
Authorization: `Bearer ${getAuthToken()}`, // Assuming you have an auth token
@@ -58,6 +61,7 @@ export const saveWelcomePageConfig = async (details) => {
}
};
export async function getOwnedCafes(userId) {
try {
const response = await fetch(