Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import axios from 'axios';
export const getSignedURL = async (
url: string,
file: File
): Promise<{ fileName: string; s3Url: string }> => {
try {
const endpoint = url;
const payload = {
filePath: file.name,
contentType: file.type,
fileSize: file.size,
};
const { data } = await axios.post(endpoint, payload);
return data as any;
} catch (err) {
if (err.response) {
throw err.response;
}
throw err;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment