Skip to content

Commit

Permalink
Andy/227 finalizing (#228)
Browse files Browse the repository at this point in the history
* add keyboard aware scroll view to personal info

* fix date validation

* use edit-patient endpoint
  • Loading branch information
andyvo2004 authored Dec 12, 2024
1 parent 980f7f2 commit 008263c
Show file tree
Hide file tree
Showing 5 changed files with 212 additions and 164 deletions.
21 changes: 21 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"react-native-element-dropdown": "^2.12.2",
"react-native-elements": "^3.4.3",
"react-native-gesture-handler": "~2.16.1",
"react-native-keyboard-aware-scroll-view": "^0.9.5",
"react-native-modal": "^13.0.1",
"react-native-pie-chart": "^3.0.2",
"react-native-progress": "^5.0.0",
Expand Down
18 changes: 11 additions & 7 deletions src/screens/Profile/ProfileScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { NativeStackScreenProps } from "@react-navigation/native-stack";
import { Button } from "react-native-elements";
import { useSelector } from "react-redux";
import SlidingUpPanel from "rn-sliding-up-panel";
import { getAuth } from "firebase/auth";
import HomeIcon from "../../assets/HomeIcon";
import ProfileIcon from "../../assets/ProfileIcon";
import SettingsIcon from "../../assets/SettingsIcon";
Expand All @@ -23,9 +24,13 @@ import ContinueButton from "../../components/ContinueButton";
type Props = NativeStackScreenProps<RootStackParamList, "ProfileScreen">;

function ProfileScreen({ navigation }: Props) {
const auth = getAuth();
const user = auth.currentUser;
const userInfo = useSelector<RootState>((state) => state.auth) as AuthUser;
const panelRef = useRef<SlidingUpPanel>(null);

console.log(userInfo);

const [name, setName] = useState("Johannes Qian");
const [dob, setDob] = useState(new Date("2000-12-31T05:00:00.000Z"));
const [areaCode, setAreaCode] = useState("+1");
Expand Down Expand Up @@ -269,8 +274,6 @@ function ProfileScreen({ navigation }: Props) {
formData.name.indexOf(" ") + 1,
formData.name.length,
);
const secondContactName = userInfo.patientDetails.secondaryContactName;
const secondContactNumber = userInfo.patientDetails.secondaryContactPhone;
const newDob = new Date(
`${formData.dob.substring(4)}-${formData.dob.substring(
0,
Expand All @@ -279,16 +282,17 @@ function ProfileScreen({ navigation }: Props) {
);
try {
const body: Record<string, string> = {
email: formData.email,
email: user.email,
firstName,
lastName,
phoneNumber: formData.phoneNumber,
birthDate: newDob.toISOString(),
secondaryContactName: secondContactName,
secondaryContactPhone: secondContactNumber,
birthDate: `${formData.dob.substring(0, 2)}-${formData.dob.substring(
2,
4,
)}-${formData.dob.substring(4)}`,
};
await internalRequest<UserAnalytics>({
url: "/api/patient/auth/signup", // replace with edit user endpoint
url: "/api/patient/edit-patient",
body,
method: HttpMethod.POST,
});
Expand Down
Loading

0 comments on commit 008263c

Please sign in to comment.