Refactor asset management components to enhance structure and improve data handling; update styles for better UI consistency

This commit is contained in:
2025-05-13 15:18:15 +05:30
parent 4c13d31931
commit 4939c19c12
8 changed files with 102 additions and 83 deletions

View File

@@ -1,7 +1,26 @@
let BackEnd_url = `http://${process.env.REACT_APP_SERVER_MARKETPLACE_URL}`;
export const fetchGltfUrl = (filename: string) => {
if (filename) {
return `${BackEnd_url}/api/v1/getAssetFile/${filename}`;
export const fetchGltfUrl = async (filename: string, AssetID: string) => {
try {
const response = await fetch(
`${BackEnd_url}/api/v2/assetDetails/${filename}/${AssetID}`,
{
method: "GET",
headers: {
"Content-Type": "application/json",
},
// body: JSON.stringify(assetData),
}
);
if (!response.ok) {
throw new Error("Failed to fetch asset details");
}
const result = await response.json();
return result;
} catch (error: any) {
//
throw new Error(error.message);
}
return null; // or handle the case when filename is not provided
};
}