Revert last few commits, as they changed too much for a hotfix
Revert "Fix readonly banner by making the me-query better cacheable"
This reverts commit 2de9fdcf12.
This commit is contained in:
parent
2ea76918eb
commit
1594bb2b68
|
|
@ -26,13 +26,28 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script>
|
||||||
import { graphql } from '@/__generated__';
|
import gql from 'graphql-tag';
|
||||||
import { LICENSE_ACTIVATION } from '@/router/auth.names';
|
import { LICENSE_ACTIVATION } from '@/router/auth.names';
|
||||||
import { useQuery } from '@vue/apollo-composable';
|
|
||||||
import { computed } from 'vue';
|
|
||||||
|
|
||||||
const query = graphql(`
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
me: {
|
||||||
|
readOnly: false,
|
||||||
|
selectedClass: {
|
||||||
|
readOnly: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
licenseActivationLink: {
|
||||||
|
name: LICENSE_ACTIVATION,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
apollo: {
|
||||||
|
me: {
|
||||||
|
query: gql`
|
||||||
query ReadOnlyQuery {
|
query ReadOnlyQuery {
|
||||||
me {
|
me {
|
||||||
readOnly
|
readOnly
|
||||||
|
|
@ -41,34 +56,30 @@ const query = graphql(`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`);
|
`,
|
||||||
|
|
||||||
const { result } = useQuery(query, null, {
|
|
||||||
fetchPolicy: 'cache-only',
|
fetchPolicy: 'cache-only',
|
||||||
});
|
update({ me }) {
|
||||||
|
if (!me) {
|
||||||
const me = computed(() => {
|
return {
|
||||||
const me = result.value?.me;
|
|
||||||
return (
|
|
||||||
me || {
|
|
||||||
readOnly: false,
|
readOnly: false,
|
||||||
selectedClass: {
|
selectedClass: {
|
||||||
readOnly: false,
|
readOnly: false,
|
||||||
},
|
},
|
||||||
|
};
|
||||||
}
|
}
|
||||||
);
|
return me;
|
||||||
});
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
const isReadOnly = computed(() => {
|
computed: {
|
||||||
return me.value.readOnly || me.value.selectedClass?.readOnly;
|
readOnlyText() {
|
||||||
});
|
return this.me.readOnly ? 'Sie besitzen keine aktive Lizenz.' : 'Sie sind in dieser Klasse nicht mehr aktiv.';
|
||||||
|
},
|
||||||
const readOnlyText = computed(() => {
|
isReadOnly() {
|
||||||
return me.value.readOnly ? 'Sie besitzen keine aktive Lizenz.' : 'Sie sind in dieser Klasse nicht mehr aktiv.';
|
return this.me.readOnly || this.me.selectedClass?.readOnly;
|
||||||
});
|
},
|
||||||
|
},
|
||||||
const licenseActivationLink = {
|
|
||||||
name: LICENSE_ACTIVATION,
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,6 @@ const typePolicies = {
|
||||||
keyFields: ['slug'],
|
keyFields: ['slug'],
|
||||||
},
|
},
|
||||||
PrivateUserNode: {
|
PrivateUserNode: {
|
||||||
keyFields: [], // i should never see anyone else's PrivateUserNode, so this should be a singleton
|
|
||||||
fields: {
|
fields: {
|
||||||
language: {
|
language: {
|
||||||
read() {
|
read() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue