Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Andy/227 finalizing #228

Merged
merged 3 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading