Skip to content

Commit f9bc3be

Browse files
committed
feat: refetch size on file upload
1 parent fee0bcc commit f9bc3be

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

ui/src/components/upload.tsx

+9
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,16 @@ import Seperator from "./seperator";
55
import axios from "axios";
66
import toast from "react-hot-toast";
77
import { useParams } from "wouter";
8+
import { sizeAtom, sizeLoadingAtom } from "../store";
9+
import { useAtom } from "jotai";
10+
import { getSize } from "../actions/getSize";
811

912
const Upload = () => {
13+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
14+
const [_, setLoading] = useAtom(sizeLoadingAtom);
15+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
16+
const [__, setSize] = useAtom(sizeAtom);
17+
1018
const tab = useParams<{ tab: "images" | "docs" }>().tab;
1119

1220
if (tab === undefined || tab === null) {
@@ -30,6 +38,7 @@ const Upload = () => {
3038
if (res.status === 200) {
3139
toast.dismiss();
3240
toast.success("Successfully uploaded file!");
41+
getSize(setSize, setLoading);
3342
}
3443
})
3544
.catch((err: Error) => {

0 commit comments

Comments
 (0)