feat: KoePi oeffentlicher Link bekommt eigenes PWA-Manifest (Dickens Prospekte, eigener Startpunkt)
This commit is contained in:
@@ -4093,6 +4093,18 @@ function PublicKoepi({ token }) {
|
||||
const [invalid, setInvalid] = useState(false);
|
||||
const BASE = '/api/tools/koepi/public/' + token;
|
||||
|
||||
// Eigenes PWA-Manifest (eigener Name "Dickens Prospekte", eigener
|
||||
// start_url) statt des normalen App-Manifests — damit eine über diesen
|
||||
// Link installierte App direkt wieder hier landet, nicht beim Login
|
||||
useEffect(() => {
|
||||
document.title = 'Dickens Prospekte';
|
||||
let link = document.querySelector('link[rel="manifest"]');
|
||||
const original = link?.getAttribute('href');
|
||||
if (!link) { link = document.createElement('link'); link.rel = 'manifest'; document.head.appendChild(link); }
|
||||
link.setAttribute('href', `${BASE}/manifest.json`);
|
||||
return () => { if (link && original) link.setAttribute('href', original); };
|
||||
}, [token]);
|
||||
|
||||
useEffect(() => {
|
||||
fetch(BASE + '/prospekte')
|
||||
.then(async r => { if (!r.ok) throw new Error(); return r.json(); })
|
||||
|
||||
Reference in New Issue
Block a user