How to let webapp user update pdf file in vite / vue3 app with vite-plugin-pwa?

22 views Asked by At

I would like to add a feature to my vite / vue3 app with vite-plugin-pwa to enable an app user to upload a new version of a pdf-file that the app links to on one of the webpages (src/components/Uitslagen.vue).

I'm not sure how to deal with the fact that these pdf-files are processed by vite, thereby changing their name (adding a hash) and copying them from a folder in src/assets/ to a folder in dist/, when running vite build. So I as a developer I would update the file in the src/assets/ folder, run vite build and publish to production, but as far as I know the app user cannot do that (or I cannot make that happen for the app user?).

So what would be the right approach for this, also considering that once this works, a notification must be pushed to all app users indicating that that file has been updated?

(The service worker is currently configured to sync with network every 20 secs, see src/ReloadPrompt.vue in https://github.com/ruud00000/wkb-app.git branch feature-fu.) Live (test)site can be viewed at wkb.computerhuys.nl.

Not sure what to do to make this work.

0

There are 0 answers