박권수

feat. need to formdata file

1 import { client } from "./client"; 1 import { client } from "./client";
2 2
3 export default { 3 export default {
4 - register : (Data : any) => { 4 + register : (Data : FormData) => {
5 return client.post('/auth/register', Data); 5 return client.post('/auth/register', Data);
6 }, 6 },
7 7
......
...@@ -26,7 +26,7 @@ const RegisterContainer = (props : RegisterProps) => { ...@@ -26,7 +26,7 @@ const RegisterContainer = (props : RegisterProps) => {
26 password : '', 26 password : '',
27 passwordCheck : '', 27 passwordCheck : '',
28 info : { 28 info : {
29 - doctorLicense : '', 29 + doctorLicense : File,
30 hospitalNm : '', 30 hospitalNm : '',
31 hospitalAddr : '', 31 hospitalAddr : '',
32 contact : '', 32 contact : '',
...@@ -225,9 +225,24 @@ const RegisterContainer = (props : RegisterProps) => { ...@@ -225,9 +225,24 @@ const RegisterContainer = (props : RegisterProps) => {
225 } else if(page === 2) { 225 } else if(page === 2) {
226 setPage(3); 226 setPage(3);
227 } else if(page === 3) { 227 } else if(page === 3) {
228 +
229 + const Data = new FormData();
230 + Data.append('userId', registerForm.userId);
231 + Data.append('password', registerForm.password);
232 + Data.append('passwordCheck', registerForm.passwordCheck);
233 +
234 + Data.append('hospitalNm', registerForm.info.hospitalNm);
235 + Data.append('hospitalAddr', registerForm.info.hospitalAddr);
236 + Data.append('contact', registerForm.info.contact);
237 + Data.append('doctorNm', registerForm.info.doctorNm);
238 + Data.append('doctorType', registerForm.info.doctorType);
239 +
240 + Data.append('doctorInfoFile', registerForm.info.doctorLicense[0]);
241 +
242 +
228 const onRegisterDoctor = async () => { 243 const onRegisterDoctor = async () => {
229 try { 244 try {
230 - const result = await authApi.registerDoctor(registerForm); 245 + const result = await authApi.registerDoctor(Data);
231 if(result.data === 'Created') { 246 if(result.data === 'Created') {
232 Alert.onSuccess('회원가입 성공, 관리자의 승인을 대기하세요.', () => props.history.push('/login')); 247 Alert.onSuccess('회원가입 성공, 관리자의 승인을 대기하세요.', () => props.history.push('/login'));
233 } 248 }
......