mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 01:46:07 +00:00
put only valid project values into store
This commit is contained in:
parent
024090e362
commit
b79ea80da1
@ -101,7 +101,7 @@ const newUserToSpace = computed(() => form.newUserToSpace)
|
||||
const logoUrl = computed(() => form.logoUrl)
|
||||
// show space
|
||||
const getSpace = gql`
|
||||
query space($id: ID!) {
|
||||
query ($id: ID!) {
|
||||
space(id: $id) {
|
||||
name
|
||||
description
|
||||
|
||||
@ -21,9 +21,9 @@ export class ProjectBrandingResolver {
|
||||
)
|
||||
}
|
||||
|
||||
@Query(() => ProjectBranding, { nullable: true })
|
||||
@Query(() => ProjectBranding)
|
||||
@Authorized([RIGHTS.PROJECT_BRANDING_VIEW])
|
||||
async projectBranding(@Arg('id', () => Int) id: number): Promise<ProjectBranding | null> {
|
||||
async projectBranding(@Arg('id', () => Int) id: number): Promise<ProjectBranding> {
|
||||
const projectBrandingEntity = await DbProjectBranding.findOneBy({ id })
|
||||
if (!projectBrandingEntity) {
|
||||
throw new LogError(`Project Branding with id: ${id} not found`)
|
||||
|
||||
@ -103,8 +103,8 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onMounted, computed } from 'vue'
|
||||
import { useLazyQuery } from '@vue/apollo-composable'
|
||||
import { onBeforeMount, computed, watchEffect } from 'vue'
|
||||
import { useQuery } from '@vue/apollo-composable'
|
||||
import AuthNavbar from '@/components/Auth/AuthNavbar'
|
||||
import AuthNavbarSmall from '@/components/Auth/AuthNavbarSmall'
|
||||
import AuthCarousel from '@/components/Auth/AuthCarousel'
|
||||
@ -115,33 +115,35 @@ import gql from 'graphql-tag'
|
||||
|
||||
const communityName = CONFIG.COMMUNITY_NAME
|
||||
const store = useStore()
|
||||
const projectValue = computed(() => {
|
||||
const urlParams = new URLSearchParams(window.location.search)
|
||||
return urlParams.get('project')
|
||||
})
|
||||
|
||||
const setTextSize = (size) => {
|
||||
document.querySelector('.page-font-size').style.fontSize = size + 'rem'
|
||||
}
|
||||
|
||||
const project = computed(() => store.state.project)
|
||||
|
||||
const {
|
||||
result: projectBannerResult,
|
||||
loading: projectBannerLoading,
|
||||
load,
|
||||
} = useLazyQuery(
|
||||
const { result: projectBannerResult, loading: projectBannerLoading } = useQuery(
|
||||
gql`
|
||||
query ($project: String!) {
|
||||
projectBrandingBanner(alias: $project)
|
||||
}
|
||||
`,
|
||||
{ project },
|
||||
{
|
||||
project: projectValue.value,
|
||||
},
|
||||
{ enabled: !!projectValue.value },
|
||||
)
|
||||
onMounted(async () => {
|
||||
const urlParams = new URLSearchParams(window.location.search)
|
||||
const projectValue = urlParams.get('project')
|
||||
if (projectValue) {
|
||||
load()
|
||||
store.commit('project', projectValue)
|
||||
} else {
|
||||
store.commit('project', '')
|
||||
|
||||
onBeforeMount(() => {
|
||||
// clear state
|
||||
store.commit('project', null)
|
||||
})
|
||||
|
||||
watchEffect(() => {
|
||||
if (projectBannerResult.value?.projectBrandingBanner) {
|
||||
store.commit('project', projectValue.value)
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user