|
|
@@ -5,9 +5,8 @@ import { useState } from 'react';
|
|
|
import SingleSelectButtonGroup from '../../../global/select_button';
|
|
|
import useSignUpStore from '../../../../providers/signup_form_store';
|
|
|
import PhoneInput from '../../../global/phone_input';
|
|
|
-import axios from 'axios';
|
|
|
-import { EXPO_PUBLIC_API_URL } from '@env';
|
|
|
import { SignUp } from '../../../../service/authService';
|
|
|
+import { CustomerData } from '../../../../types/signUpFormData';
|
|
|
|
|
|
type CreateWalletProps = {
|
|
|
goToNextPage: () => void;
|
|
|
@@ -59,49 +58,33 @@ const CreateWallet: React.FC<CreateWalletProps> = ({ goToNextPage }) => {
|
|
|
|
|
|
const [error, setError] = useState('');
|
|
|
|
|
|
- let customerData: {
|
|
|
- customerBaseInfo: {
|
|
|
- name: string;
|
|
|
- email: string;
|
|
|
- password: string;
|
|
|
- gender: string;
|
|
|
- birthday: string;
|
|
|
- address: string | undefined;
|
|
|
- isUberDriver: boolean | undefined;
|
|
|
- };
|
|
|
- customerCarInfo?: {
|
|
|
- type_id: string | undefined;
|
|
|
- brand_id: string | undefined;
|
|
|
- licensePlate: string | undefined;
|
|
|
- };
|
|
|
- };
|
|
|
- //if signUpFormData.selectedCarModel is empty,
|
|
|
- //it means user clicks 略過 and did not fill out information
|
|
|
- //So, I only send customerData.customerBaseInfo to the back end.
|
|
|
- //And I don't send customerCarInfo (since I don't have it)
|
|
|
+
|
|
|
+
|
|
|
+ let customerData: CustomerData;
|
|
|
if (signUpFormData.selectedCarModel === '') {
|
|
|
+ // Empty SelectedCarModel means user has clicked "略過"
|
|
|
customerData = {
|
|
|
customerBaseInfo: {
|
|
|
- name: signUpFormData.name,
|
|
|
+ name: signUpFormData.nickName.trim(),
|
|
|
email: signUpFormData.email,
|
|
|
password: signUpFormData.password,
|
|
|
gender: signUpFormData.gender,
|
|
|
birthday: signUpFormData.birthDate,
|
|
|
address: signUpFormData.address,
|
|
|
+ phone: signUpFormData.phone,
|
|
|
isUberDriver: signUpFormData.isUberDriver
|
|
|
}
|
|
|
};
|
|
|
} else {
|
|
|
- //but if signUpFormData.licensePlate is not empty
|
|
|
- //then I send everything to the back end.
|
|
|
customerData = {
|
|
|
customerBaseInfo: {
|
|
|
- name: signUpFormData.name,
|
|
|
+ name: signUpFormData.nickName.trim(),
|
|
|
email: signUpFormData.email,
|
|
|
password: signUpFormData.password,
|
|
|
gender: signUpFormData.gender,
|
|
|
birthday: signUpFormData.birthDate,
|
|
|
address: signUpFormData.address,
|
|
|
+ phone: signUpFormData.phone,
|
|
|
isUberDriver: signUpFormData.isUberDriver
|
|
|
},
|
|
|
customerCarInfo: {
|