-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1 parent
89fcc8d
commit c8dcebd
Showing
8 changed files
with
63 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import type { GeneralSettings } from '~/schemas/setting'; | ||
|
||
export function usePublicGeneralSettings() { | ||
const generalSettings = useState<GeneralSettings>('public-general-settings'); | ||
const updateGeneralSettings = (gs: GeneralSettings) => { | ||
generalSettings.value = gs; | ||
}; | ||
return { generalSettings, updateGeneralSettings }; | ||
} | ||
|
||
export function usePublicOrganizationSettings() { | ||
const { generalSettings } = usePublicGeneralSettings(); | ||
return computed(() => generalSettings.value.organization); | ||
} | ||
|
||
export function usePublicSeoSettings() { | ||
const { generalSettings } = usePublicGeneralSettings(); | ||
return computed(() => generalSettings.value.seo); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import type { GeneralSettings } from '~/schemas/setting'; | ||
|
||
export default defineNuxtPlugin(async () => { | ||
const remoteAssetBase = useState('remote-asset-base-url', () => ''); | ||
try { | ||
const remoteAssetConfig = await useAsyncData('remove-asset-base-url-fetch', () => | ||
$fetch('/api/public/remote-assets-config'), | ||
); | ||
if (!remoteAssetConfig.data.value?.base) { | ||
throw new Error('base url not found in response ' + remoteAssetConfig.data.value); | ||
} | ||
remoteAssetBase.value = remoteAssetConfig.data.value?.base; | ||
} catch (error) { | ||
console.error('error fetching remote-asset-config', error); | ||
} | ||
|
||
const publicGeneralSettings = useState<GeneralSettings>('public-general-settings'); | ||
try { | ||
const publicGeneralSettingsResponse = await useAsyncData('public-general-settings-fetch', () => | ||
$fetch('/api/public/settings'), | ||
); | ||
if (!publicGeneralSettingsResponse.data.value) { | ||
throw new Error('Invalid response ' + publicGeneralSettingsResponse.data.value); | ||
} | ||
publicGeneralSettings.value = publicGeneralSettingsResponse.data.value; | ||
} catch (error) { | ||
console.error('error fetching public-general-settings', error); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters