2
0

Add cache-control header on newly uploaded files

This commit is contained in:
Baptiste Arnaud
2023-11-01 15:42:53 +01:00
parent a5641811a3
commit d1502f8300
6 changed files with 6 additions and 3 deletions

View File

@ -31,6 +31,7 @@ export const UploadButton = ({
Object.entries(data.formData).forEach(([key, value]) => { Object.entries(data.formData).forEach(([key, value]) => {
formData.append(key, value) formData.append(key, value)
}) })
formData.append('Cache-Control', 'max-age=86400')
formData.append('file', file) formData.append('file', file)
const upload = await fetch(data.presignedUrl, { const upload = await fetch(data.presignedUrl, {
method: 'POST', method: 'POST',

View File

@ -40,6 +40,7 @@ export const uploadFiles = async ({
Object.entries(data.formData).forEach(([key, value]) => { Object.entries(data.formData).forEach(([key, value]) => {
formData.append(key, value) formData.append(key, value)
}) })
formData.append('Cache-Control', 'max-age=86400')
formData.append('file', file) formData.append('file', file)
const upload = await fetch(data.presignedUrl, { const upload = await fetch(data.presignedUrl, {
method: 'POST', method: 'POST',

View File

@ -1,6 +1,6 @@
{ {
"name": "@typebot.io/js", "name": "@typebot.io/js",
"version": "0.2.11", "version": "0.2.12",
"description": "Javascript library to display typebots on your website", "description": "Javascript library to display typebots on your website",
"type": "module", "type": "module",
"main": "dist/index.js", "main": "dist/index.js",

View File

@ -43,6 +43,7 @@ export const uploadFiles = async ({
Object.entries(data.formData).forEach(([key, value]) => { Object.entries(data.formData).forEach(([key, value]) => {
formData.append(key, value) formData.append(key, value)
}) })
formData.append('Cache-Control', 'max-age=86400')
formData.append('file', file) formData.append('file', file)
const upload = await fetch(data.presignedUrl, { const upload = await fetch(data.presignedUrl, {
method: 'POST', method: 'POST',

View File

@ -1,6 +1,6 @@
{ {
"name": "@typebot.io/nextjs", "name": "@typebot.io/nextjs",
"version": "0.2.11", "version": "0.2.12",
"description": "Convenient library to display typebots on your Next.js website", "description": "Convenient library to display typebots on your Next.js website",
"main": "dist/index.js", "main": "dist/index.js",
"types": "dist/index.d.ts", "types": "dist/index.d.ts",

View File

@ -1,6 +1,6 @@
{ {
"name": "@typebot.io/react", "name": "@typebot.io/react",
"version": "0.2.11", "version": "0.2.12",
"description": "Convenient library to display typebots on your React app", "description": "Convenient library to display typebots on your React app",
"main": "dist/index.js", "main": "dist/index.js",
"types": "dist/index.d.ts", "types": "dist/index.d.ts",