Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…into feature/parth4apple/student-form-updates
  • Loading branch information
aaronchan32 committed Dec 1, 2024
2 parents f711b1e + 058c01b commit 00ac200
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { UserData } from "@/pages/profile";
export const useFetchPersonalInfo = (userData: UserData) => {
const { piaUser, firebaseUser } = userData;
const [loading, setLoading] = useState(true);
const [basicInfoData, setBasicInfoData] = useState({ name: "", image: "", userId: "" });
const [basicInfoData, setBasicInfoData] = useState({ name: "", image: "" });
const [contactInfoData, setContactInfoData] = useState({ email: "" });
const [passwordData, setPasswordData] = useState({ last_changed: null as Date | null });
const [firebaseToken, setFirebaseToken] = useState("");
Expand All @@ -27,14 +27,14 @@ export const useFetchPersonalInfo = (userData: UserData) => {
});
}
if (piaUser.profilePicture === "default") {
setBasicInfoData((prev) => ({ ...prev, userId: piaUser._id, image: "default" }));
setBasicInfoData((prev) => ({ ...prev, image: "default" }));
} else if (piaUser.profilePicture && firebaseToken) {
setCurrentImageId(piaUser.profilePicture);
getPhoto(piaUser.profilePicture, piaUser._id, "user", firebaseToken).then(
getPhoto(piaUser.profilePicture, firebaseToken).then(
(result) => {
if (result.success) {
const newImage = result.data;
setBasicInfoData((prev) => ({ ...prev, userId: piaUser._id, image: newImage }));
setBasicInfoData((prev) => ({ ...prev, image: newImage }));
} else {
console.error(result.error);
}
Expand Down

0 comments on commit 00ac200

Please sign in to comment.