Skip to content

Commit

Permalink
Merge pull request #142 from lucyjemutai/auth-link
Browse files Browse the repository at this point in the history
ensure we have no 404 error and also limit upload size
  • Loading branch information
lucyjemutai authored Sep 23, 2024
2 parents 0a226de + 438103c commit 1debe0c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
12 changes: 12 additions & 0 deletions pages/auth/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export async function getServerSideProps() {
return {
redirect: {
destination: "/",
permanent: false,
},
};
}

const AuthIndex = () => null;

export default AuthIndex;
10 changes: 9 additions & 1 deletion pages/resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,15 @@ function ResourcesKnhts() {

const handleFileSelect = (event) => {
const filesArray = Array.from(event.target.files);
setSelectedFiles([...selectedFiles, ...filesArray]);
const filteredFiles = filesArray.filter(
(file) => file.size <= 5 * 1024 * 1024
);

if (filesArray.length !== filteredFiles.length) {
alert("This file exceeds the maximum allowed size of 5MB.");
}

setSelectedFiles([...selectedFiles, ...filteredFiles]);
};

const handleFileUpload = () => {
Expand Down

0 comments on commit 1debe0c

Please sign in to comment.