feat: render app shell with ssr to improve loading experience (#448)
This commit is contained in:
parent
b545efeacc
commit
9395b7031e
35 changed files with 169 additions and 127 deletions
|
@ -8,10 +8,9 @@ export interface TranslationResponse {
|
|||
}
|
||||
}
|
||||
|
||||
const config = useRuntimeConfig()
|
||||
|
||||
export const languageCode = process.server ? 'en' : navigator.language.replace(/-.*$/, '')
|
||||
export async function translateText(text: string, from?: string | null, to?: string) {
|
||||
const config = useRuntimeConfig()
|
||||
const { translatedText } = await $fetch<TranslationResponse>(config.public.translateApi, {
|
||||
method: 'POST',
|
||||
body: {
|
||||
|
@ -41,7 +40,7 @@ export function useTranslation(status: Status) {
|
|||
}
|
||||
|
||||
return {
|
||||
enabled: !!config.public.translateApi,
|
||||
enabled: !!useRuntimeConfig().public.translateApi,
|
||||
toggle,
|
||||
translation,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue