🐛 fix(config): NoStore

This commit is contained in:
web@ppanel
2024-12-08 16:09:27 +07:00
parent a1e4999a2f
commit 2cc18cf559
6 changed files with 29 additions and 37 deletions
@@ -1,7 +1,9 @@
'use client';
import { Display } from '@/components/display';
import useGlobalStore from '@/config/use-global';
import { Icon } from '@iconify/react';
import { isBrowser } from '@repo/ui/utils';
import { Button } from '@shadcn/ui/button';
import { Card, CardContent, CardHeader, CardTitle } from '@shadcn/ui/card';
import { toast } from '@shadcn/ui/lib/sonner';
@@ -14,6 +16,7 @@ import Recharge from './order/recharge';
export function SidebarRight({ ...props }: React.ComponentProps<typeof Sidebar>) {
const { user } = useGlobalStore();
const t = useTranslations('layout');
return (
<Sidebar collapsible='none' side='right' {...props}>
<SidebarContent>
@@ -33,7 +36,7 @@ export function SidebarRight({ ...props }: React.ComponentProps<typeof Sidebar>)
<Tooltip>
<TooltipTrigger asChild>
<CopyToClipboard
text={`${location.origin}/auth?invite=${user?.refer_code}`}
text={`${isBrowser() && location?.origin}/auth?invite=${user?.refer_code}`}
onCopy={(text, result) => {
if (result) {
toast.success(t('copySuccess'));
+3 -6
View File
@@ -2,10 +2,7 @@
import useGlobalStore from '@/config/use-global';
import { checkUser, resetPassword, userLogin, userRegister } from '@/services/common/auth';
import { Icon } from '@iconify/react';
import { Button } from '@shadcn/ui/button';
import { toast } from '@shadcn/ui/lib/sonner';
import { cn } from '@shadcn/ui/lib/utils';
import { useTranslations } from 'next-intl';
import { useRouter } from 'next/navigation';
import { ReactNode, useState, useTransition } from 'react';
@@ -132,9 +129,9 @@ export default function UserAuthForm() {
{t(`${type || 'check'}.description`)}
</div>
</div>
{!((type === 'register' && register.stop_register) || type === 'reset') && (
{/* {!((type === 'register' && register.stop_register) || type === 'reset') && (
<>
<div className='mb-3 flex flex-wrap items-center justify-center gap-3 font-bold'>
<div className='mb-3 grid items-center justify-center gap-3 font-bold lg:grid-cols-3'>
<Button type='button' variant='outline'>
<Icon icon='uil:telegram' className='mr-2 size-5' />
Telegram
@@ -158,7 +155,7 @@ export default function UserAuthForm() {
<span className='text-muted-foreground w-[125px] text-sm'>{t('orWithEmail')}</span>
</div>
</>
)}
)} */}
{UserForm}
</>
);
+2
View File
@@ -7,12 +7,14 @@ import { Toaster } from '@shadcn/ui/sonner';
import { NextIntlClientProvider } from 'next-intl';
import { getLocale, getMessages } from 'next-intl/server';
import { PublicEnvScript } from 'next-runtime-env';
import { unstable_noStore as noStore } from 'next/cache';
import { cookies } from 'next/headers';
import { Metadata, Viewport } from 'next/types';
import NextTopLoader from 'nextjs-toploader';
import React from 'react';
export async function generateMetadata(): Promise<Metadata> {
noStore();
let site: API.SiteConfig | undefined;
await getGlobalConfig({ skipErrorHandler: true })