Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create common upload function #94

Open
simenandre opened this issue Dec 29, 2020 · 0 comments
Open

Create common upload function #94

simenandre opened this issue Dec 29, 2020 · 0 comments
Labels
needs-triage Needs attention from the triage team

Comments

@simenandre
Copy link
Member

simenandre commented Dec 29, 2020

We probably want to have a function that does file uploads (including getting signed URL).

Re:

async (files: FileList) => {
_.map(Array.from(files), async ({ name, type, size }, i) => {
const {
data: {
signedUrl: { url, accessUrl },
},
}: { data: GetSignedUrl } = await gqlClient.query({
query: QUERY_GET_SIGNED_URL,
variables: {
input: {
filename: name,
contentType: type,
contentLength: size,
},
},
});
await fetch(url, { method: 'PUT', body: files[i] });
console.log(accessUrl);
setFieldValue('images', [
...(form.values.images || []),
{ url: accessUrl },
]);

@simenandre simenandre added the needs-triage Needs attention from the triage team label May 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-triage Needs attention from the triage team
Projects
None yet
Development

No branches or pull requests

1 participant