@@ -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 ,
@@ -109,12 +113,24 @@ export const MainPage: React.FC = () => {
109113 label = { '๋ค์ด๋ก๋ ํ์' }
110114 />
111115 < CheckBox
116+ click = { ( ) => {
117+ setPasswordBoolean ( ! passwordBoolean ) ;
118+ } }
112119 click = { ( ) => setPasswordBoolean ( ! passwordBoolean ) }
113120 isCheck = { passwordBoolean }
114121 label = { '๋น๋ฐ๋ฒํธ' }
115122 />
116123 </ S . MainPageCheckBoxSection >
117- { passwordBoolean ? < PasswordInput placeholder = "๋น๋ฐ๋ฒํธ๋ฅผ ์
๋ ฅํด์ฃผ์ธ์." /> : < > </ > }
124+ { passwordBoolean ? (
125+ < PasswordInput
126+ onChange = { ( text ) => {
127+ setPassword ( text . target . value . replace ( / ( \s * ) / g, '' ) ) ;
128+ } }
129+ placeholder = "๋น๋ฐ๋ฒํธ๋ฅผ ์
๋ ฅํด์ฃผ์ธ์."
130+ />
131+ ) : (
132+ < > </ >
133+ ) }
118134 < FileFind handleChangeFile = { handleChangeFile } fileProps = { fileProps } />
119135 < UpLoadButton type = { 'button' } value = { '์
๋ก๋' } onClick = { UpLoad } />
120136 </ >
0 commit comments