Skip to content

Commit

Permalink
Merge pull request #14 from ananjaemin/13-password-function-์ ์šฉ
Browse files Browse the repository at this point in the history
13 password function ์ ์šฉ
  • Loading branch information
ananjaemin committed Nov 1, 2022
2 parents d02b92c + b852512 commit d61d404
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
4 changes: 3 additions & 1 deletion public/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,7 @@
);
</script>
</head>
<body></body>
<body>
404
</body>
</html>
20 changes: 18 additions & 2 deletions src/pages/main/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const MainPage: React.FC = () => {
const [retentionPeriod, setRetentionPeriod] = useState(false);
const [downloadCount, setDownloadCount] = useState(false);
const [passwordBoolean, setPasswordBoolean] = useState(false);
const [password, setPassword] = useState('');
const [fileProps, setFileProps] = useState({ name: '', size: '', fileType: '', fileData: '' });

const navigate = useNavigate();
Expand All @@ -41,7 +42,9 @@ export const MainPage: React.FC = () => {
formdata.append('file', fileProps.fileData);
await axios({
method: 'post',
url: 'https://tfb.minpeter.cf/upload',
url: `https://tfb.minpeter.cf/upload${
passwordBoolean && password != '' && password != undefined ? `?pw=${password}` : ''
}`,
data: formdata,
headers: {
'Content-Type': 'multipart/form-data',
Expand All @@ -52,6 +55,7 @@ export const MainPage: React.FC = () => {
},
})
.then(async (res) => {
console.log(res);
setUploading(true);
toast.success('์—…๋กœ๋“œ ์„ฑ๊ณต!', {
autoClose: 3000,
Expand Down Expand Up @@ -109,12 +113,24 @@ export const MainPage: React.FC = () => {
label={'๋‹ค์šด๋กœ๋“œ ํšŸ์ˆ˜'}
/>
<CheckBox
click={() => {
setPasswordBoolean(!passwordBoolean);
}}
click={() => setPasswordBoolean(!passwordBoolean)}
isCheck={passwordBoolean}
label={'๋น„๋ฐ€๋ฒˆํ˜ธ'}
/>
</S.MainPageCheckBoxSection>
{passwordBoolean ? <PasswordInput placeholder="๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”." /> : <></>}
{passwordBoolean ? (
<PasswordInput
onChange={(text) => {
setPassword(text.target.value.replace(/(\s*)/g, ''));
}}
placeholder="๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”."
/>
) : (
<></>
)}
<FileFind handleChangeFile={handleChangeFile} fileProps={fileProps} />
<UpLoadButton type={'button'} value={'์—…๋กœ๋“œ'} onClick={UpLoad} />
</>
Expand Down

0 comments on commit d61d404

Please sign in to comment.