-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐞 fix(chat):Fix uploadthing api callback
- Loading branch information
1 parent
678418f
commit a2c9501
Showing
12 changed files
with
321 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
export { default as useDeleteWorkspaceFile } from './useDeleteWorkspaceFile'; | ||
export { default as useGetUploadStatus } from './useGetUploadStatus'; | ||
export { default as useGetWorkspaceFile } from './useGetWorkspaceFile'; | ||
export { default as useGetWorkspaceFiles } from './useGetWorkspaceFiles'; | ||
export { default as useGetWorkspaceFileWithKey } from './useGetWorkspaceFileWithKey'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { useQuery } from '@tanstack/react-query'; | ||
|
||
import client from '@/common/libs/rpc'; | ||
|
||
interface UseGetUploadStatusProps { | ||
fileId: string; | ||
} | ||
|
||
const useGetUploadStatus = ({ fileId }: UseGetUploadStatusProps) => { | ||
const query = useQuery({ | ||
queryKey: ['uploadStatus', fileId], | ||
queryFn: async () => { | ||
const response = await client.api.files.uploadStatus[':fileId'].$get({ | ||
param: { fileId }, | ||
}); | ||
|
||
if (!response.ok) { | ||
throw new Error('Failed to fetch file'); | ||
} | ||
|
||
const { data } = await response.json(); | ||
|
||
return data; | ||
}, | ||
refetchInterval: (data) => | ||
data.state.status === 'success' || data.state.status === 'error' | ||
? false | ||
: 500, | ||
}); | ||
|
||
return query; | ||
}; | ||
|
||
export default useGetUploadStatus; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.