I have built an app with APS viewer, and i can't get this to work. When i upload a new model to the same bucket with the same name, even using 'x-ads-forcé': 'true', and HTTP_REQUEST_HEADERS, Will still show old model.
This is my translation fuction:
export const createTranslationJob = async (urn: string) => {
const responseToken = await getToken();
const token = responseToken.data.access_token;
const postURL = `${credentials.BaseURL}/modelderivative/${credentials.Version}/designdata/job`;
const postBody = {
input: {
urn
},
output: {
formats: [
{
type: "svf2",
views: ["2d", "3d"]
}
]
}
}
const response = await axios.post(postURL, postBody, {
headers: {
'Content-Type': 'application/json',
// 'Accept': 'application/json',
'Authorization': `Bearer ${token}`,
'x-ads-force': 'true', //force to delete the existing manifest and create a fresh manifest
//CORS
'Access-Control-Allow-Origin': `${process.env.NEXTAUTH_URL}`,
}
});
return response;}
And this is my init viewer fuction:
export const initViewer = async (divId: string) => {
let viewer: Autodesk.Viewing.GuiViewer3D;
const getClientToken = await Client.getAccesstoken();
// debugger;
const tolkenData = getClientToken.data;
const tolken = tolkenData.access_token;
const options = {
env: 'AutodeskProduction2',
api: 'streamingV2',
accessToken: tolken,
};
await Autodesk.Viewing.Initializer(options, () => {
const config3d = {
extensions: [
// 'CameraLockExtension',
// 'EventsTutorial',
// 'CustomizedToolbarExtension'
// 'rebarColorExtension',
],
};
Autodesk.Viewing.HTTP_REQUEST_HEADERS = {
"If-Modified-Since": "Sat, 29 Oct 1994 19:43:31 GMT"
};
const htmlDiv = document.getElementById(divId);
viewer = new Autodesk.Viewing.GuiViewer3D(htmlDiv!, config3d);
const startedCode = viewer.start();
if (startedCode > 0) {
console.error('Failed to create a Viewer: WebGL not supported.');
}
console.log('Initialization complete, loading a model next...');
});
return viewer!;
}
Any help??