2025-05-19 14:50:33 +05:30
|
|
|
let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}`;
|
|
|
|
|
|
2025-05-26 17:58:46 +05:30
|
|
|
export const viewProject = async (organization: string,projectId: string,userId: string) => {
|
2025-05-19 14:50:33 +05:30
|
|
|
try {
|
2025-05-26 17:58:46 +05:30
|
|
|
const response = await fetch(`${url_Backend_dwinzo}/api/v2/Project/${projectId}`,
|
2025-05-19 14:50:33 +05:30
|
|
|
{
|
|
|
|
|
method: "GET",
|
|
|
|
|
headers: {
|
2025-05-26 17:58:46 +05:30
|
|
|
Authorization: "Bearer <access_token>", // Replace with actual token
|
2025-05-19 14:50:33 +05:30
|
|
|
"Content-Type": "application/json",
|
2025-05-26 17:58:46 +05:30
|
|
|
token: localStorage.getItem("token") || "", // Coerce null to empty string
|
|
|
|
|
refresh_token: localStorage.getItem("refreshToken") || "",
|
2025-05-19 14:50:33 +05:30
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (!response.ok) {
|
|
|
|
|
throw new Error("Failed to fetch");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return await response.json();
|
|
|
|
|
} catch (error: any) {
|
|
|
|
|
console.error("Failed to get asset image:", error);
|
|
|
|
|
throw new Error(error.message);
|
|
|
|
|
}
|
|
|
|
|
};
|
2025-05-26 10:20:35 +05:30
|
|
|
|