@@ -18,6 +18,7 @@ export const MainPage: React.FC = () => {
1818 const [ retentionPeriod , setRetentionPeriod ] = useState ( false ) ;
1919 const [ downloadCount , setDownloadCount ] = useState ( false ) ;
2020 const [ passwordBoolean , setPasswordBoolean ] = useState ( false ) ;
21+ const [ password , setPassword ] = useState ( '' ) ;
2122 const [ fileProps , setFileProps ] = useState ( { name : '' , size : '' , fileType : '' , fileData : '' } ) ;
2223
2324 const navigate = useNavigate ( ) ;
@@ -41,7 +42,9 @@ export const MainPage: React.FC = () => {
4142 formdata . append ( 'file' , fileProps . fileData ) ;
4243 await axios ( {
4344 method : 'post' ,
44- url : 'https://tfb.minpeter.cf/upload' ,
45+ url : `https://tfb.minpeter.cf/upload${
46+ passwordBoolean && password != '' && password != undefined ? `?pw=${ password } ` : ''
47+ } `,
4548 data : formdata ,
4649 headers : {
4750 'Content-Type' : 'multipart/form-data' ,
@@ -52,6 +55,7 @@ export const MainPage: React.FC = () => {
5255 } ,
5356 } )
5457 . then ( async ( res ) => {
58+ console . log ( res ) ;
5559 setUploading ( true ) ;
5660 toast . success ( '업로드 성공!' , {
5761 autoClose : 3000 ,
@@ -120,17 +124,22 @@ export const MainPage: React.FC = () => {
120124 />
121125 < CheckBox
122126 click = { ( ) => {
123- setPasswordBoolean ( false ) ;
124- toast . success ( '제작중!' , {
125- autoClose : 1000 ,
126- position : toast . POSITION . BOTTOM_RIGHT ,
127- } ) ;
127+ setPasswordBoolean ( ! passwordBoolean ) ;
128128 } }
129129 isCheck = { passwordBoolean }
130130 label = { '비밀번호' }
131131 />
132132 </ S . MainPageCheckBoxSection >
133- { passwordBoolean ? < PasswordInput placeholder = "비밀번호를 입력해주세요." /> : < > </ > }
133+ { passwordBoolean ? (
134+ < PasswordInput
135+ onChange = { ( text ) => {
136+ setPassword ( text . target . value . replace ( / ( \s * ) / g, '' ) ) ;
137+ } }
138+ placeholder = "비밀번호를 입력해주세요."
139+ />
140+ ) : (
141+ < > </ >
142+ ) }
134143 < FileFind handleChangeFile = { handleChangeFile } fileProps = { fileProps } />
135144 < UpLoadButton type = { 'button' } value = { '업로드' } onClick = { UpLoad } />
136145 </ >
0 commit comments