Skip to content

Commit

Permalink
fix typescript errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenny Vong authored and Jenny Vong committed Mar 31, 2024
1 parent 26af005 commit 3e0d67a
Show file tree
Hide file tree
Showing 5 changed files with 151 additions and 320 deletions.
10 changes: 5 additions & 5 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"@types/jest": "^26.0.24",
"@types/json2csv": "^5.0.7",
"@types/node": "^12.20.55",
"@types/react": "18",
"@types/react-dom": "18",
"@types/react": "^17.0.78",
"@types/react-dom": "^17.0.25",
"@types/react-jsonschema-form": "^1.7.13",
"@types/react-table": "^7.7.20",
"apollo-upload-client": "^16.0.0",
Expand All @@ -33,9 +33,9 @@
"json-schema": "^0.3.0",
"json2csv": "^5.0.7",
"jsonwebtoken": "^8.5.1",
"react": "18",
"react": "^17.0.2",
"react-bootstrap": "^1.6.8",
"react-dom": "18",
"react-dom": "^17.0.2",
"react-feather": "^2.0.10",
"react-google-login": "^5.2.2",
"react-json-schema": "^1.2.2",
Expand All @@ -44,7 +44,7 @@
"react-router-dom": "^5.3.4",
"react-scripts": "4.0.2",
"react-table": "^7.8.0",
"typescript": "4.1.2",
"typescript": "^4.1.2",
"web-vitals": "^1.1.2"
},
"scripts": {
Expand Down
10 changes: 5 additions & 5 deletions frontend/src/APIClients/CaregiverAPIClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const post = async (
});
return data;
} catch (error) {
return error;
throw new Error("Error: can't make new caregiver");
}
};

Expand All @@ -89,7 +89,7 @@ const getById = async (intake_id: number): Promise<Caregivers> => {
},
);

const mappedData: Caregivers = data.map((caregiver) => ({
const mappedData: Caregivers = data.map((caregiver: Caregiver) => ({
intakeId: caregiver.intake_id,
caregiverName: caregiver.name,
dateOfBirth: caregiver.date_of_birth,
Expand All @@ -111,7 +111,7 @@ const getById = async (intake_id: number): Promise<Caregivers> => {

return mappedData;
} catch (error) {
return error;
throw new Error("Error: given id, can't get caregiver");
}
};

Expand Down Expand Up @@ -173,7 +173,7 @@ const put = async (
);
return data;
} catch (error) {
return error;
throw new Error("Error: can't get caregivers");
}
};

Expand All @@ -191,7 +191,7 @@ const deleteCaregiver = async (caregiverId: number): Promise<void> => {
);
return response.data;
} catch (error) {
return error;
throw new Error("Error: can't delete caregiver");
}
};

Expand Down
10 changes: 5 additions & 5 deletions frontend/src/APIClients/EntityAPIClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const create = async ({
});
return data;
} catch (error) {
return error;
throw new Error("Error: can't make new entity");
}
};

Expand All @@ -57,7 +57,7 @@ const get = async (): Promise<EntityResponse[]> => {
});
return data;
} catch (error) {
return error;
throw new Error("Error: can't get entities");
}
};

Expand All @@ -73,7 +73,7 @@ const getFile = async (uuid: string): Promise<string> => {

return data.fileUrl;
} catch (error) {
return error;
throw new Error("Error: can't get requested file");
}
};

Expand All @@ -92,7 +92,7 @@ const getCSV = async (): Promise<string> => {

return data;
} catch (error) {
return error;
throw new Error("Error: can't get csv file");
}
};

Expand All @@ -114,7 +114,7 @@ const update = async (
});
return data;
} catch (error) {
return error;
throw new Error("Error: can't udpate entity");
}
};

Expand Down
14 changes: 7 additions & 7 deletions frontend/src/APIClients/IntakeAPIClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const post = async (formData: any): Promise<Case> => {
});
return data;
} catch (error) {
return error;
throw new Error("Error: can't make new intake");
}
};

Expand All @@ -62,7 +62,7 @@ const search = async (searchParam: string): Promise<Case[]> => {
},
});

const mappedDataCase: Case[] = data.map((intake) => ({
const mappedDataCase: Case[] = data.map((intake: Intake) => ({
user_id: intake.userId.toString(),
case_id: intake.caseId.toString(),
intakeStatus: <CaseStatus>intake.intakeStatus,
Expand Down Expand Up @@ -145,7 +145,7 @@ const search = async (searchParam: string): Promise<Case[]> => {

return mappedDataCase;
} catch (error) {
return error;
throw new Error("Error: can't get intake serach results");
}
};

Expand All @@ -171,7 +171,7 @@ const get = async (
},
});

const mappedData = data.map((intake) => ({
const mappedData = data.map((intake: Intake) => ({
user_id: intake.userId.toString(),
case_id: intake.caseId.toString(),
intakeStatus: <CaseStatus>intake.intakeStatus,
Expand Down Expand Up @@ -254,7 +254,7 @@ const get = async (

return mappedData;
} catch (error) {
return error;
throw new Error("Error: can't get intakes");
}
};

Expand All @@ -279,7 +279,7 @@ const put = async ({
);
return data;
} catch (error) {
return error;
throw new Error("Error: can't update intake");
}
};

Expand All @@ -294,7 +294,7 @@ const deleteIntake = async (intakeId: number): Promise<void> => {
});
return response.data;
} catch (error) {
return error;
throw new Error("Error: can't delete intake");
}
};
export default { post, get, put, deleteIntake, search };
Loading

0 comments on commit 3e0d67a

Please sign in to comment.