diff options
Diffstat (limited to 'src/pages/File.tsx')
-rw-r--r-- | src/pages/File.tsx | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/pages/File.tsx b/src/pages/File.tsx index 4e06d01..5a69d01 100644 --- a/src/pages/File.tsx +++ b/src/pages/File.tsx @@ -65,6 +65,11 @@ export default function File(props: any) { return parts[parts.length - 1] } + const restoreFile = async (file: FSTracerFile) => { + console.log("RESTORING FILE: user_id: ", props.session.user.id, " file: ", file.absolute_path, " ", file.contents, " ", file.timestamp) + await props.supabase.from('restored_file').insert({ absolute_path: file.absolute_path, contents: file.contents, timestamp: file.timestamp, user_id: props.session.user.id }) + } + return ( <> <div className="flex h-screen"> @@ -85,7 +90,7 @@ export default function File(props: any) { <div className="block border rounded shadow py-5 px-5 bg-blue"> {files.map((currFile: FSTracerFile) => ( <div key={currFile.id}> - <span>{currFile.absolute_path} - {currFile.timestamp} {currFile.id === file.id && "*"}</span><button onClick={() => { }}><span> </span><b>Restore</b></button> + <a href={"/file/" + currFile.id}>{currFile.absolute_path} - {currFile.timestamp} {currFile.id === file.id && "*"}</a><button onClick={() => { restoreFile(currFile) }}><span> </span><b>Restore</b></button> </div> )) } |