Files
Dwinzo_Demo/app/src/services/dashboard/duplicateProject.ts

49 lines
1.2 KiB
TypeScript

let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}`;
export const duplicateProject = async (
refProjectID: string,
projectUuid: string,
thumbnail: string,
projectName: string
) => {
try {
const response = await fetch(
`${url_Backend_dwinzo}/api/V1/project/Duplicate`,
{
method: "POST",
headers: {
Authorization: "Bearer <access_token>", // Replace with actual token
"Content-Type": "application/json",
token: localStorage.getItem("token") || "", // Coerce null to empty string
refresh_token: localStorage.getItem("refreshToken") || "",
},
body: JSON.stringify({
refProjectID,
projectUuid,
thumbnail,
projectName,
}),
}
);
const newAccessToken = response.headers.get("x-access-token");
if (newAccessToken) {
//
localStorage.setItem("token", newAccessToken);
}
if (!response.ok) {
}
const result = await response.json();
//
return result;
} catch (error) {
if (error instanceof Error) {
} else {
}
}
};