import axios from 'axios' export const updateImageCache = async( url: string, type?: 'json' | 'arraybuffer' ) => { try { if (!isImage(url)) { return } const now = new Date().getTime().toString() const config: any = { method: 'get', url: `${url}` } if (type) { config.responseType = type config.url += '?not-from-cache-please' } else { config.url += `#${now}` } return await axios(config) } catch (err) { console.log(err) } return false } function isImage(url: string) { return /\.(jpg|jpeg|png|webp|avif|gif|svg)$/.test(url) }