diff --git a/app/src/app/[lng]/data/review/page.tsx b/app/src/app/[lng]/data/review/page.tsx index fb1ffde72..1af792c1d 100644 --- a/app/src/app/[lng]/data/review/page.tsx +++ b/app/src/app/[lng]/data/review/page.tsx @@ -59,6 +59,15 @@ export default function ReviewPage({ const [isConfirming, setIsConfirming] = useState(false); + const { data: userInfo, isLoading: isUserInfoLoading } = + api.useGetUserInfoQuery(); + + const { data: inventory } = api.useGetInventoryQuery( + userInfo?.defaultInventoryId!, + { skip: !userInfo }, + ); + const cityId = inventory?.city.cityId; + const onConfirm = async () => { setIsConfirming(true); try { @@ -79,7 +88,7 @@ export default function ReviewPage({ formData.append("data", file, file.name); } - await addUserFile(formData).then(() => { + await addUserFile({ formData, cityId }).then(() => { // TODO // Trigger notification to user }); diff --git a/app/src/app/api/v0/city/[city]/file/route.ts b/app/src/app/api/v0/city/[city]/file/route.ts index acda459c4..89fde54d5 100644 --- a/app/src/app/api/v0/city/[city]/file/route.ts +++ b/app/src/app/api/v0/city/[city]/file/route.ts @@ -78,7 +78,7 @@ export const POST = apiHandler(async (req: NextRequest, context) => { const fileData = { userId: userId, - cityId: formData.get("cityId"), + cityId: context.params.city, fileReference: formData.get("fileReference"), url: formData.get("url"), data: buffer, diff --git a/app/src/components/Tabs/my-files-tab.tsx b/app/src/components/Tabs/my-files-tab.tsx index fe31cca9d..d5922d63e 100644 --- a/app/src/components/Tabs/my-files-tab.tsx +++ b/app/src/components/Tabs/my-files-tab.tsx @@ -125,8 +125,6 @@ const MyFilesTab: FC = ({ lastUpdated: "", }); - console.log(cityData); - const [fileData, setFileData] = useState(); return ( diff --git a/app/src/services/api.ts b/app/src/services/api.ts index a830898a5..783edd234 100644 --- a/app/src/services/api.ts +++ b/app/src/services/api.ts @@ -319,10 +319,10 @@ export const api = createApi({ transformResponse: (response: { data: any }) => response.data, }), addUserFile: builder.mutation({ - query: (formData) => { + query: ({ formData, cityId }) => { return { method: "POST", - url: `/user/file`, + url: `city/${cityId}/file`, body: formData, }; },