fix kashkool
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import { computed, inject, provide, type InjectionKey, type ComputedRef } from 'vue'
|
||||
import { getConfig } from '@/config/app-config'
|
||||
import { getAboutSections, type AboutSection } from '../aboutContent'
|
||||
|
||||
export interface AboutPageContext {
|
||||
projectName: ComputedRef<string>
|
||||
aboutSections: ComputedRef<AboutSection[]>
|
||||
supportHref: ComputedRef<string>
|
||||
}
|
||||
|
||||
export const ABOUT_PAGE_CONTEXT_KEY: InjectionKey<AboutPageContext> = Symbol('aboutPageContext')
|
||||
|
||||
const SUPPORT_LINK = 'https://web.rubika.ir/#c=u0I8F1U0a939b0df5ba9f73618d33d7c'
|
||||
|
||||
export function useAboutPage() {
|
||||
const projectName = computed(() => getConfig('name_fa', 'کشکول گلد'))
|
||||
const aboutSections = computed(() => getAboutSections(projectName.value))
|
||||
const supportHref = computed(() => SUPPORT_LINK)
|
||||
|
||||
const context: AboutPageContext = { projectName, aboutSections, supportHref }
|
||||
provide(ABOUT_PAGE_CONTEXT_KEY, context)
|
||||
return context
|
||||
}
|
||||
|
||||
export function useAboutPageContext() {
|
||||
const context = inject(ABOUT_PAGE_CONTEXT_KEY)
|
||||
if (!context) throw new Error('useAboutPageContext must be used within useAboutPage')
|
||||
return context
|
||||
}
|
||||
Reference in New Issue
Block a user