Refactor asset management components to enhance structure and improve data handling; update styles for better UI consistency
This commit is contained in:
@@ -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
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user