Skip to content

Commit

Permalink
fix: refresh page after uploading all files
Browse files Browse the repository at this point in the history
  • Loading branch information
WallysFerreira committed Jan 26, 2024
1 parent 56c05d3 commit d96d108
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ui/src/components/upload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const Upload = () => {

const file = useRef<HTMLInputElement>(null);

const uploadFile = () => {
const uploadFile = async () => {
const files = file.current?.files;

if (files !== null && files !== undefined) {
Expand All @@ -33,7 +33,8 @@ const Upload = () => {
for (let file of files) {
const form = new FormData();
form.append(type, file);
axios

await axios
.post<{ url: string }>(`/api/cdn/upload/${type}`, form)
.then((res) => {
if (res.status === 200) {
Expand All @@ -47,6 +48,8 @@ const Upload = () => {
toast.error(err.message);
});
}

location.reload();
}
};

Expand Down

0 comments on commit d96d108

Please sign in to comment.