Skip to content

Commit

Permalink
Fixed linting issue
Browse files Browse the repository at this point in the history
  • Loading branch information
jholleran committed Jul 25, 2024
1 parent 2411b15 commit bf10738
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 deletions.
26 changes: 18 additions & 8 deletions api/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,26 +35,36 @@ export const postFile = async (file: FileObject): Promise<void> => {
const formData = new FormData();
formData.append("file", {
name: file.name,
type: file.contentType || mime.getType(file.name) || "application/octet-stream",
type:
file.contentType || mime.getType(file.name) || "application/octet-stream",
uri: file.uri,
} as unknown as Blob);

try {
const response = await fetch(`${process.env.EXPO_PUBLIC_WALLET_API}/wallet`, {
const response = await fetch(
`${process.env.EXPO_PUBLIC_WALLET_API}/wallet`,
{
method: "PUT",
body: formData,
});
}
);

if (response.ok) {
console.debug("Uploaded file to Wallet. HTTP response status:" + response.status);
console.debug(
`Uploaded file to Wallet. HTTP response status:${response.status}`
);
} else {
throw Error("Failed to upload file to Wallet. HTTP response status from Wallet Backend service:" +
response.status);
throw Error(
`Failed to upload file to Wallet. HTTP response status from Wallet Backend service:${
response.status
}`
);
}
} catch (error) {
throw Error("Failed to retrieve and upload file to Wallet", { cause: error });
throw Error("Failed to retrieve and upload file to Wallet", {
cause: error,
});
}

};

export const deleteFile = async (fileId: string): Promise<void> => {
Expand Down
10 changes: 5 additions & 5 deletions app/(tabs)/home/download.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const Page: React.FC<FileDetailProps> = () => {
},
onError: (error) => {
// TODO: there needs to be better error handling here...
console.warn(error)
console.warn(error);
},
mutationKey: ["filesMutation"],
});
Expand All @@ -61,10 +61,10 @@ const Page: React.FC<FileDetailProps> = () => {
const { goBack } = useNavigation();
const onSaveToWallet = async () => {
mutation.mutate({
uri: uri as String,
name: fileName,
contentType: contentType
})
uri: uri as string,
name: fileName,
contentType,
});
goBack();
};
useLayoutEffect(() => {
Expand Down

0 comments on commit bf10738

Please sign in to comment.