Implement API enhancements for token management and new endpoints
- Added token management for various API calls in the factoryBuilder and visualization services. - Updated deleteLayerApi, deleteLineApi, deletePointApi, getLinesApi, setLineApi, updatePointApi, and version control APIs to handle new access tokens from response headers. - Introduced new API endpoints for 3D widget and floating widget data retrieval. - Enhanced error handling and logging for API responses. - Created new sessionValidity and input retrieval components for better session management and data handling.
This commit is contained in:
@@ -3,7 +3,10 @@ let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_UR
|
||||
export const adding3dWidgets = async (
|
||||
zoneUuid: string,
|
||||
organization: string,
|
||||
widget: {}
|
||||
widget: {},
|
||||
projectId?: string,
|
||||
versionId?: string
|
||||
|
||||
) => {
|
||||
try {
|
||||
const response = await fetch(`${url_Backend_dwinzo}/api/V1/widget3d/save`, {
|
||||
@@ -14,9 +17,16 @@ export const adding3dWidgets = async (
|
||||
token: localStorage.getItem("token") || "",
|
||||
refresh_token: localStorage.getItem("refreshToken") || "",
|
||||
},
|
||||
body: JSON.stringify({ organization, zoneUuid, widget }),
|
||||
body: JSON.stringify({ organization, zoneUuid, widget, projectId, versionId }),
|
||||
});
|
||||
|
||||
const newAccessToken = response.headers.get("x-access-token");
|
||||
if (newAccessToken) {
|
||||
//console.log("New token received:", newAccessToken);
|
||||
localStorage.setItem("token", newAccessToken);
|
||||
}
|
||||
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to add 3dwidget in the zone");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user