fix: Typescript check (#21)
* fix: typescript check error * fix: typescript check error * fix: typescript check error * fix: typescript check error * fix: typescript check error
This commit is contained in:
@@ -7,6 +7,7 @@ import Avatar from 'boring-avatars';
|
||||
import { fetchMyProjects } from '@/utils/projectsControl';
|
||||
import { ProjectType } from '@/types/project';
|
||||
import PublicityChip from '@/components/PublicityChip';
|
||||
import { LocaleCodeType } from '@/types/locale';
|
||||
|
||||
type AccountPageMessages = {
|
||||
yourProjects: string;
|
||||
@@ -17,7 +18,7 @@ type AccountPageMessages = {
|
||||
|
||||
type Props = {
|
||||
messages: AccountPageMessages;
|
||||
locale: string;
|
||||
locale: LocaleCodeType;
|
||||
};
|
||||
|
||||
export default function AccountPage({ messages, locale }: Props) {
|
||||
@@ -50,13 +51,13 @@ export default function AccountPage({ messages, locale }: Props) {
|
||||
<CardHeader className="flex gap-6">
|
||||
<Avatar
|
||||
size={48}
|
||||
name={context.token.user.username}
|
||||
name={context.token!.user!.username}
|
||||
variant="beam"
|
||||
colors={['#0A0310', '#49007E', '#FF005B', '#FF7D10', '#FFB238']}
|
||||
/>
|
||||
<div className="flex flex-col">
|
||||
<p className="text-xl font-bold">{context.token.user.username}</p>
|
||||
<p className="text-lg text-default-500">{context.token.user.email}</p>
|
||||
<p className="text-xl font-bold">{context.token!.user!.username}</p>
|
||||
<p className="text-lg text-default-500">{context.token!.user!.email}</p>
|
||||
</div>
|
||||
</CardHeader>
|
||||
</Card>
|
||||
|
||||
@@ -77,9 +77,4 @@ function generateRandomEmail() {
|
||||
return `${randomString}@example.com`;
|
||||
}
|
||||
|
||||
function getRandomAvatarPath() {
|
||||
const randomIndex = Math.floor(Math.random() * avatars.length);
|
||||
return avatars[randomIndex];
|
||||
}
|
||||
|
||||
export { signUp, signIn, signInAsGuest, getRandomAvatarPath };
|
||||
export { signUp, signIn, signInAsGuest };
|
||||
|
||||
@@ -11,12 +11,13 @@ import { isValidEmail, isValidPassword } from './validate';
|
||||
import { TokenContext } from '@/utils/TokenProvider';
|
||||
import { useRouter } from '@/src/navigation';
|
||||
import Config from '@/config/config';
|
||||
import { LocaleCodeType } from '@/types/locale';
|
||||
const isDemoSite = Config.isDemoSite;
|
||||
|
||||
type Props = {
|
||||
isSignup: Boolean;
|
||||
isSignup: boolean;
|
||||
messages: AuthMessages;
|
||||
locale: string;
|
||||
locale: LocaleCodeType;
|
||||
};
|
||||
|
||||
export default function AuthPage({ isSignup, messages, locale }: Props) {
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import { useTranslations } from 'next-intl';
|
||||
import AccountPage from './AccountPage';
|
||||
export default function Page(params: { locale: string }) {
|
||||
import { PageType } from '@/types/base';
|
||||
import { LocaleCodeType } from '@/types/locale';
|
||||
|
||||
export default function Page({ params }: PageType) {
|
||||
const t = useTranslations('Auth');
|
||||
const messages = {
|
||||
yourProjects: t('your_projects'),
|
||||
@@ -9,5 +12,5 @@ export default function Page(params: { locale: string }) {
|
||||
noProjectsFound: t('no_projects_found'),
|
||||
};
|
||||
|
||||
return <AccountPage messages={messages} locale={params.locale} />;
|
||||
return <AccountPage messages={messages} locale={params.locale as LocaleCodeType} />;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import { PageType } from '@/types/base';
|
||||
import AuthPage from '../authPage';
|
||||
import { useTranslations } from 'next-intl';
|
||||
import { LocaleCodeType } from '@/types/locale';
|
||||
|
||||
export default function Page(params: { locale: string }) {
|
||||
export default function Page({ params }: PageType) {
|
||||
const t = useTranslations('Auth');
|
||||
const messages = {
|
||||
title: t('signin'),
|
||||
@@ -24,7 +26,7 @@ export default function Page(params: { locale: string }) {
|
||||
};
|
||||
return (
|
||||
<>
|
||||
<AuthPage isSignup={false} messages={messages} locale={params.locale} />
|
||||
<AuthPage isSignup={false} messages={messages} locale={params.locale as LocaleCodeType} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import { PageType } from '@/types/base';
|
||||
import AuthPage from '../authPage';
|
||||
import { useTranslations } from 'next-intl';
|
||||
import { LocaleCodeType } from '@/types/locale';
|
||||
|
||||
export default function Page(params: { locale: string }) {
|
||||
export default function Page({ params }: PageType) {
|
||||
const t = useTranslations('Auth');
|
||||
const messages = {
|
||||
title: t('signup'),
|
||||
@@ -24,7 +26,7 @@ export default function Page(params: { locale: string }) {
|
||||
};
|
||||
return (
|
||||
<>
|
||||
<AuthPage isSignup={true} messages={messages} locale={params.locale} />
|
||||
<AuthPage isSignup={true} messages={messages} locale={params.locale as LocaleCodeType} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user