CatchTheTornado / doctor-dok

Doctor Dok is an AI based medical data framework and patient's med vault. Parse any health related PDF/Image to JSON and then use Chat GPT / LLama to discuss it! WARNING: Don't decide on your health based on AI Chat - it's just for Research purposes.
http://doctordok.com
MIT License
54 stars 10 forks source link

[bug] Download attachment got blocked on Safari iOS popup blocker #204

Open pkarw opened 1 month ago

pkarw commented 1 month ago

example workaround (?):

  const onMouseClick = async () => {
    var windowReference = window.open()
    try {
      const apiResponse = await getFacturaPdfByNrFac(nrFactura.replace("/", ""))
      if (apiResponse.type) {
        var url = createObjectURL(apiResponse)
        windowReference.location = url
      }
    } catch (error) {
      console.error(error)
    }
  }

export function createObjectURL(file) {
  if (window.webkitURL) {
    return window.webkitURL.createObjectURL(file)
  } else if (window.URL && window.URL.createObjectURL) {
    return window.URL.createObjectURL(file)
  } else {
    return null
  }
}