disable cache for fetch inputimage

This commit is contained in:
Sanster 2022-03-27 13:50:41 +08:00
parent 705e12d02d
commit a6f29be662
2 changed files with 6 additions and 2 deletions

View File

@ -3,7 +3,7 @@ import React, { useEffect, useState } from 'react'
import { useToggle, useWindowSize } from 'react-use'
import Button from './components/Button'
import FileSelect from './components/FileSelect'
import useInputImage from './components/hooks/useInputImage'
import useInputImage from './hooks/useInputImage'
import ShortcutsModal from './components/ShortcutsModal'
import Editor from './Editor'

View File

@ -4,7 +4,11 @@ export default function useInputImage() {
const [inputImage, setInputImage] = useState<File>()
const fetchInputImage = useCallback(() => {
fetch('/inputimage')
const headers = new Headers()
headers.append('pragma', 'no-cache')
headers.append('cache-control', 'no-cache')
fetch('/inputimage', { headers })
.then(res => res.blob())
.then(data => {
if (data && data.type.startsWith('image')) {