@bindu-dashing/dam-solution-v2 5.8.160 → 5.8.161
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -43,18 +43,30 @@ const CreateClientForm = ({ teamsApi, username, password, toggleShow, onSuccess,
|
|
|
43
43
|
setFetchingClientData(true);
|
|
44
44
|
try {
|
|
45
45
|
let fetchedData;
|
|
46
|
-
|
|
46
|
+
// TEMPORARY: Using static brandId for testing - remove after testing
|
|
47
|
+
let brandId = (existingClientData === null || existingClientData === void 0 ? void 0 : existingClientData.brandId) || "68a2f214f7e91fbee730b0b9";
|
|
48
|
+
console.log("Edit mode - existingClientData:", existingClientData);
|
|
49
|
+
console.log("Using brandId:", brandId);
|
|
47
50
|
// If brandId is not provided, try to get it from subdomain first
|
|
48
|
-
if (!brandId && (existingClientData === null || existingClientData === void 0 ? void 0 : existingClientData.subdomain)) {
|
|
51
|
+
if (!(existingClientData === null || existingClientData === void 0 ? void 0 : existingClientData.brandId) && (existingClientData === null || existingClientData === void 0 ? void 0 : existingClientData.subdomain)) {
|
|
49
52
|
console.log("brandId not found, fetching by subdomain first:", existingClientData.subdomain);
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
try {
|
|
54
|
+
const subdomainResponse = yield api.get(`${FETCH_BRAND_USING_SUBDOMAIN}?subdomain=${existingClientData.subdomain}`);
|
|
55
|
+
const subdomainData = get(subdomainResponse, "data.data", {});
|
|
56
|
+
const extractedBrandId = get(subdomainData, "_id");
|
|
57
|
+
if (extractedBrandId) {
|
|
58
|
+
brandId = extractedBrandId;
|
|
59
|
+
console.log("Extracted brandId from subdomain response:", brandId);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
catch (subdomainError) {
|
|
63
|
+
console.warn("Failed to fetch by subdomain, using static brandId:", subdomainError);
|
|
64
|
+
}
|
|
54
65
|
}
|
|
55
|
-
//
|
|
66
|
+
// Always use brands/details endpoint with brandId
|
|
56
67
|
if (brandId) {
|
|
57
68
|
console.log("Fetching brand details using brandId:", brandId);
|
|
69
|
+
console.log("API endpoint:", `/brands/details/${brandId}`);
|
|
58
70
|
// Use reusable fetchBrandDetails function
|
|
59
71
|
fetchedData = yield fetchBrandDetails(api, brandId);
|
|
60
72
|
console.log("Fetched client data from brands/details:", fetchedData);
|