Update manifest on page change
This commit is contained in:
parent
b71ca34dd3
commit
edba09be4c
@ -2,7 +2,7 @@
|
||||
"name": "Co Jedzie?{% if provider %} - {{ provider.shortName }}{% endif %}",
|
||||
"short_name": "Co Jedzie?{% if provider %} - {{ provider.shortName }}{% endif %}",
|
||||
"orientation": "portrait",
|
||||
"lang": "pl_PL",
|
||||
"lang": "pl-PL",
|
||||
"start_url": "{{ provider ? path('app', { provider: provider.identifier }) : path('choose') }}",
|
||||
"display": "standalone",
|
||||
"background_color": "white",
|
||||
|
@ -4,6 +4,7 @@ import { Action, Mutation, State } from 'vuex-class'
|
||||
import { Provider, Stop } from "@/model";
|
||||
import { DeparturesSettingsState } from "@/store/settings/departures";
|
||||
import { MessagesSettingsState } from "@/store/settings/messages";
|
||||
import urls from "@/urls";
|
||||
|
||||
@Component({ template: require("@templates/main.html") })
|
||||
export class Main extends Vue {
|
||||
@ -46,6 +47,7 @@ export class Main extends Vue {
|
||||
|
||||
mounted() {
|
||||
this.$el.classList.remove('not-ready');
|
||||
document.querySelector<HTMLLinkElement>('link[rel="manifest"]').href = urls.prepare(urls.manifest.provider, { provider: this.$route.params.provider });
|
||||
}
|
||||
|
||||
async created() {
|
||||
|
@ -3,6 +3,7 @@ import { Component } from 'vue-property-decorator'
|
||||
import { Provider } from "@/model";
|
||||
import { Jsonified } from "@/utils";
|
||||
import * as moment from 'moment';
|
||||
import urls from "@/urls";
|
||||
|
||||
@Component({
|
||||
template: require('@templates/page/providers.html'),
|
||||
@ -10,6 +11,10 @@ import * as moment from 'moment';
|
||||
export class ProviderChooser extends Vue {
|
||||
private providers: Provider[] = [];
|
||||
|
||||
mounted() {
|
||||
document.querySelector<HTMLLinkElement>('link[rel="manifest"]').href = urls.manifest.main;
|
||||
}
|
||||
|
||||
async created() {
|
||||
const response = await fetch('/api/v1/providers');
|
||||
const result = await response.json() as Jsonified<Provider>[];
|
||||
|
@ -66,5 +66,9 @@ export default {
|
||||
get: `/api/v1/providers/{provider}`,
|
||||
},
|
||||
trip: `${base}/trips/{id}`,
|
||||
manifest: {
|
||||
main: '/manifest.json',
|
||||
provider: '/{provider}/manifest.json',
|
||||
},
|
||||
prepare: (url: string, params: UrlParams = { }) => prepare(url, Object.assign({}, { provider: store.state.provider?.id }, params))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user