Skip to content

Commit d61d404

Browse files
authored
Merge pull request #14 from ananjaemin/13-password-function-์ ์šฉ
13 password function ์ ์šฉ
2 parents d02b92c + b852512 commit d61d404

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

โ€Žpublic/404.htmlโ€Ž

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,7 @@
4242
);
4343
</script>
4444
</head>
45-
<body></body>
45+
<body>
46+
404
47+
</body>
4648
</html>

โ€Žsrc/pages/main/index.tsxโ€Ž

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
ย (0)