-
-
Notifications
You must be signed in to change notification settings - Fork 603
Closed as not planned
Labels
enhancementNew feature or requestNew feature or requestopenapi-react-queryRelevant to openapi-react-queryRelevant to openapi-react-query
Description
Description
currently have similar code:
const {
data: screenshotBlob,
isLoading,
error,
} = api.useQuery('get', '/screenshot/{ctMmId}/{time}', {
params: { path: { ctMmId: id, time: timestamp } },
parseAs: 'blob',
});
const screenshotFile = useMemo(
() =>
screenshotBlob
? new File([screenshotBlob], 'screenshot.jpg', { type: 'image/jpeg' })
: undefined,
[screenshotBlob]
);
const screenshotBase64 = useBase64FromFile(screenshotFile);
and would like to hear if you would consider adding something like base64 option to the parseAs prop
so the with this new option my code could be much cleaner:
const {
data: screenshotBase64,
isLoading,
error,
} = api.useQuery('get', '/screenshot/{ctMmId}/{time}', {
params: { path: { ctMmId: id, time: timestamp } },
parseAs: 'base64',
});
Proposal
Consider adding base64 option to parseAs property, which will do the conversion and instead of Blob will return to base64 string?
Extra
- I’m willing to open a PR (see CONTRIBUTING.md)
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestopenapi-react-queryRelevant to openapi-react-queryRelevant to openapi-react-query