|
|
@@ -1,5 +1,6 @@
|
|
|
"use client";
|
|
|
|
|
|
+import { useKindeBrowserClient } from "@kinde-oss/kinde-auth-nextjs";
|
|
|
import React, { useState, useEffect } from "react";
|
|
|
import {
|
|
|
ColumnDef,
|
|
|
@@ -42,6 +43,7 @@ export function FilesTable() {
|
|
|
const [rowSelection, setRowSelection] = useState<RowSelectionState>({});
|
|
|
const [files, setFiles] = useState<FileData[]>([]);
|
|
|
const [isUploading, setIsUploading] = useState(false);
|
|
|
+ const { user } = useKindeBrowserClient();
|
|
|
|
|
|
const { data, isLoading, isError, error, refetch } = useQuery({
|
|
|
queryKey: ["files"],
|
|
|
@@ -189,7 +191,8 @@ export function FilesTable() {
|
|
|
// Import the server action
|
|
|
const { uploadFile } = await import('../actions/file-upload');
|
|
|
|
|
|
- const uploadedFile = await uploadFile(file);
|
|
|
+ const userId = user?.id ? user.id : "unknown-user-id";
|
|
|
+ const uploadedFile = await uploadFile(file, userId);
|
|
|
|
|
|
// Use the uploadedFile response to update the table immediately
|
|
|
const newFile: FileData = {
|