fix cf build issues
This commit is contained in:
@@ -5,15 +5,15 @@ const SUPPORTED_LANGUAGES = config?.loaders?.map((loader) => loader.locale) || [
|
||||
export const load = async ({ url, data }) => {
|
||||
const { pathname } = url;
|
||||
|
||||
const serverLang = data.serverLang?.split?.('-')?.[0] || 'en';
|
||||
const persistedLocale = data.localeCookie || getPersistedLocale();
|
||||
const serverLang = data?.serverLang?.split?.('-')?.[0] || 'en';
|
||||
const persistedLocale = data?.localeCookie || getPersistedLocale();
|
||||
|
||||
const userLocale = persistedLocale || data.locals?.profile?.locale || getInitialLocale(serverLang);
|
||||
const userLocale = persistedLocale || data?.locals?.profile?.locale || getInitialLocale(serverLang);
|
||||
|
||||
const initLocale = getInitialLocale(userLocale);
|
||||
await loadTranslations(initLocale, pathname); // keep this just before the `return`
|
||||
|
||||
return data;
|
||||
return data ?? {};
|
||||
};
|
||||
|
||||
function getInitialLocale(lang: string): string {
|
||||
|
||||
@@ -35,14 +35,14 @@
|
||||
class:animate={isHovered}
|
||||
>
|
||||
<path d="M12 7v14" class="center-line" />
|
||||
<path d="M16 12h2" class="ui:text-line ui:text-line-right-bottom" />
|
||||
<path d="M16 8h2" class="ui:text-line ui:text-line-right-top" />
|
||||
<path d="M16 12h2" class="text-line text-line-right-bottom" />
|
||||
<path d="M16 8h2" class="text-line text-line-right-top" />
|
||||
<path
|
||||
d="M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z"
|
||||
class="book-path"
|
||||
/>
|
||||
<path d="M6 12h2" class="ui:text-line ui:text-line-left-bottom" />
|
||||
<path d="M6 8h2" class="ui:text-line ui:text-line-left-top" />
|
||||
<path d="M6 12h2" class="text-line text-line-left-bottom" />
|
||||
<path d="M6 8h2" class="text-line text-line-left-top" />
|
||||
</svg>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user