frontend: switch auth ctx personal user info to camel case
Pedro Lucas Porcellis porcellis@eletrotupi.com · 5 months ago
ac4f34f0d9d8b58e053ff6ca647845eb2894c129 Browse filesParents
e9742feChanged files
2
Additions
+6
Deletions
-6
frontend/app/auth/signup.tsx
1 1
import React, { useState } from 'react';
2 2
import {
3 3
View,
4 4
Text,
5 5
StyleSheet,
64 64
const handleSignup = async () => {
65 65
if (!validateForm()) return;
66 66
67 67
try {
68 68
await signup({
69 -
first_name: firstName,
70 -
last_name: lastName || undefined,
69 +
firstName,
70 +
lastName,
71 71
email,
72 72
password,
73 73
});
74 74
router.replace('/(tabs)');
75 75
} catch (error: any) {
210 210
},
211 211
footerText: {
212 212
fontSize: 14,
213 213
},
214 214
});
frontend/context/AuthContext.tsx
1 1
import React, { createContext, useContext, useEffect, useState } from 'react';
2 2
import { apiClient, User } from '@/lib/api';
3 3
4 4
interface AuthProviderProps {
5 5
children: React.ReactNode;
9 9
user: User | null;
10 10
isLoading: boolean;
11 11
isAuthenticated: boolean;
12 12
login: (email: string, password: string) => Promise<void>;
13 13
signup: (userData: {
14 -
first_name: string;
15 -
last_name?: string;
14 +
firstName: string;
15 +
lastName?: string;
16 16
email: string;
17 17
password: string;
18 18
}) => Promise<void>;
19 19
logout: () => Promise<void>;
20 20
forgotPassword: (email: string) => Promise<{ message: string; token?: string }>;
79 79
setIsLoading(false);
80 80
}
81 81
};
82 82
83 83
const signup = async (userData: {
84 -
first_name: string;
85 -
last_name?: string;
84 +
firstName: string;
85 +
lastName?: string;
86 86
email: string;
87 87
password: string;
88 88
}) => {
89 89
setIsLoading(true);
90 90
try {
128 128
<AuthContext.Provider value={value}>
129 129
{children}
130 130
</AuthContext.Provider>
131 131
);
132 132
}