user settings, points slider

This commit is contained in:
ivic00
2024-09-20 19:47:21 +02:00
parent 39ef35022c
commit b46fb1b2a8
12 changed files with 203 additions and 113 deletions

View File

@ -7,7 +7,8 @@ export interface User {
export interface UserProfile {
userType: ProfileType;
name: string;
firstName: string;
lastName: string;
childrenIds?: string[];
birthday?: Date;
parentId?: string;

View File

@ -8,9 +8,9 @@ export const useSignUp = () => {
return useMutation({
mutationKey: ["signUp"],
mutationFn: async ({email, password}: { email: string, password: string }) => {
mutationFn: async ({email, password, firstName, lastName}: { email: string, password: string, firstName: string, lastName: string }) => {
const res = await auth().createUserWithEmailAndPassword(email, password);
await updateUserData({newUserData: {userType: ProfileType.PARENT}, customUser: res.user});
await updateUserData({newUserData: {userType: ProfileType.PARENT, firstName: firstName, lastName: lastName}, customUser: res.user});
}
});
}

View File

@ -17,7 +17,7 @@ export const useUpdateUserData = () => {
await firestore()
.collection("Profiles")
.doc(user.uid)
.set(newUserData);
.update(newUserData);
const profileData = await firestore().collection("Profiles").doc(user?.uid!).get()
setProfileData(profileData.data() as UserProfile)