Refactor DashboardCard component: add active prop handling and improve option click logic

This commit is contained in:
2025-05-29 09:55:31 +05:30
parent 0184abdd7a
commit c8627e0249
4 changed files with 34 additions and 10 deletions

View File

@@ -7,9 +7,9 @@ export const recentlyViewed = async (organization: string, userId: string) => {
{
method: "GET",
headers: {
Authorization: "Bearer <access_token>", // Replace with actual token
Authorization: "Bearer <access_token>", // Replace with actual token
"Content-Type": "application/json",
token: localStorage.getItem("token") || "", // Coerce null to empty string
token: localStorage.getItem("token") || "", // Coerce null to empty string
refresh_token: localStorage.getItem("refreshToken") || "",
},
}
@@ -18,9 +18,7 @@ export const recentlyViewed = async (organization: string, userId: string) => {
if (!response.ok) {
throw new Error("Failed to fetch project");
}
console.log('response: ', response);
return await response.json();
} catch (error: any) {
console.error("Failed to get project");

View File

@@ -4,7 +4,7 @@ const url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_
export const restoreTrash = async (organization: string, projectId: string) => {
try {
const response = await fetch(
`${url_Backend_dwinzo}api/v2/Trash/restore?projectId=${projectId}`,
`${url_Backend_dwinzo}/api/v2/Trash/restore?projectId=${projectId}`,
{
method: "PATCH",
headers: {