Fixed more TypeScript issues

This commit is contained in:
Ferdinand Thiessen 2020-10-29 00:12:46 +01:00
parent 5a4f6939d1
commit 3f756437ee
2 changed files with 23 additions and 23 deletions

View File

@ -41,7 +41,7 @@ export default defineComponent({
},
setup(props, { root }) {
let title = props.title;
let title = computed<string>(() => {
if (props.title.includes('loadFromStore')) {
const startIndex = props.title.indexOf('(') + 1;
const endIndex = props.title.indexOf(')');
@ -49,12 +49,11 @@ export default defineComponent({
.substring(startIndex, endIndex)
.replace(/"/g, '');
console.log(substring);
console.log(root.$store.getters[substring]);
console.log('loadFromStore');
title = computed(() => {
return root.$store.getters[substring];
});
return <string>root.$store.getters[substring];
}
return props.title;
});
return { realTitle: title };
}
});

View File

@ -22,10 +22,7 @@
/>
</div>
<div class="row">
<q-btn
label="show sessions"
@click="showRootGetters"
/>
<q-btn label="show sessions" @click="showRootGetters" />
</div>
</q-page>
</div>
@ -41,18 +38,22 @@ export default defineComponent({
components: { CircularProgress, Sessions, Main },
setup(_, { root }) {
onBeforeMount(() => {
root.$store.dispatch('sessions/getSessions');
root.$store.dispatch('sessions/getSessions').catch(error => {
console.warn(error);
});
const sessions = computed(() => root.$store.getters['sessions/sessions']);
});
const sessions = computed(
() => <FG.Session[]>root.$store.getters['sessions/sessions']
);
function showRootGetters() {
//ctx.root.$store.dispatch('sessions/getSessions');
console.log(sessions.value);
}
const sessionsLoading = computed(() => {
return root.$store.getters['sessions/loading'];
});
const sessionsLoading = computed(
() => <boolean>root.$store.getters['sessions/loading']
);
return {
showRootGetters,