Skip to content

Commit 772dff4

Browse files
authored
Merge pull request #59 from teacoder-team/dev
fix: resolve all typedRoutes errors
2 parents 86c9772 + 77858b9 commit 772dff4

File tree

11 files changed

+49
-29
lines changed

11 files changed

+49
-29
lines changed

next.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ const config: NextConfig = {
1414
],
1515
dangerouslyAllowSVG: false
1616
},
17+
typedRoutes: false,
1718
experimental: {
1819
optimizePackageImports: ['tailwindcss'],
19-
typedRoutes: true,
2020
serverActions: {
2121
bodySizeLimit: '2mb'
2222
},

src/components/account/connections/connection-error.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use client'
22

33
import { AlertTriangle } from 'lucide-react'
4+
import type { Route } from 'next'
45
import { useRouter, useSearchParams } from 'next/navigation'
56
import { useEffect, useState } from 'react'
67

@@ -65,9 +66,12 @@ export function ConnectionError() {
6566

6667
params.delete('error')
6768

68-
router.replace(`${window.location.pathname}?${params.toString()}`, {
69-
scroll: false
70-
})
69+
router.replace(
70+
`${window.location.pathname}?${params.toString()}` as any as Route,
71+
{
72+
scroll: false
73+
}
74+
)
7175
}
7276

7377
if (!isVisible || !errorInfo) return null

src/components/account/connections/connections.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export function Connections() {
4646

4747
const { mutate, isPending } = useSsoConnect({
4848
onSuccess(data) {
49-
router.push(data.url)
49+
router.push(data.url as any)
5050
},
5151
onError(error: any) {
5252
toast.error(

src/components/auth/auth-social.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export function AuthSocial() {
4141
onSuccess(data, variables) {
4242
analytics.auth.social.success(variables)
4343

44-
router.push(data.url)
44+
router.push(data.url as any)
4545
},
4646
onError(error: any, variables) {
4747
analytics.auth.social.fail(variables, error.message)

src/components/auth/auth-wrapper.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { Route } from 'next'
12
import Image from 'next/image'
23
import Link from 'next/link'
34
import type { ReactNode } from 'react'
@@ -10,7 +11,7 @@ interface AuthWrapperProps {
1011
description?: string
1112
bottomText?: string
1213
bottomLinkText?: string
13-
bottomLinkHref?: string
14+
bottomLinkHref?: Route
1415
isShowSocial?: boolean
1516
}
1617

src/components/auth/login-form.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use client'
22

33
import { zodResolver } from '@hookform/resolvers/zod'
4+
import type { Route } from 'next'
45
import Link from 'next/link'
56
import { useRouter, useSearchParams } from 'next/navigation'
67
import { useEffect, useState } from 'react'
@@ -72,7 +73,7 @@ export function LoginForm() {
7273
const redirectTo =
7374
searchParams.get('redirectTo') || ROUTES.ACCOUNT.ROOT
7475

75-
router.push(redirectTo)
76+
router.push(redirectTo as Route)
7677
}
7778
},
7879
onError(error: any) {

src/components/auth/mfa-form.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { startAuthentication } from '@simplewebauthn/browser'
22
import { ArrowLeftIcon, KeyIcon } from 'lucide-react'
3+
import { Route } from 'next'
34
import { useRouter, useSearchParams } from 'next/navigation'
45
import { useEffect, useState } from 'react'
56
import { toast } from 'sonner'
@@ -45,7 +46,7 @@ export function MfaForm({ ticket, methods, userId, onBack }: MfaFormProps) {
4546
const redirectTo =
4647
searchParams.get('redirectTo') || ROUTES.ACCOUNT.ROOT
4748

48-
router.push(redirectTo)
49+
router.push(redirectTo as Route)
4950
},
5051
onError(error: any, variables) {
5152
const message = error.response?.data?.message ?? 'Ошибка при входе'

src/components/course/course-actions.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export function CourseActions({ course }: CourseActionsProps) {
6161
</Button>
6262
{course.youtubeUrl && (
6363
<Button variant='outline' className='w-full' asChild>
64-
<Link href={course.youtubeUrl} target='_blank'>
64+
<Link href={course.youtubeUrl as any} target='_blank'>
6565
<FaYoutube />
6666
Смотреть на YouTube
6767
</Link>

src/components/layout/footer.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use client'
22

33
import { ExternalLink } from 'lucide-react'
4+
import { Route } from 'next'
45
import Link from 'next/link'
56
import { JSX } from 'react'
67
import { FaGithub } from 'react-icons/fa'
@@ -10,7 +11,7 @@ import { ROUTES } from '@/src/constants'
1011

1112
interface NavLink {
1213
title: string
13-
href: string
14+
href: Route
1415
isExternal?: boolean
1516
}
1617

@@ -135,7 +136,7 @@ function FooterLink({ title, href, isExternal }: NavLink) {
135136
function SocialLink({ href, icon, label }: SocialLink) {
136137
return (
137138
<Link
138-
href={href}
139+
href={href as Route}
139140
className='text-muted-foreground transition-colors hover:text-primary'
140141
target='_blank'
141142
referrerPolicy='no-referrer'

src/components/layout/nav-links.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
import type { Route } from 'next'
12
import Link from 'next/link'
23

34
import { ROUTES } from '@/src/constants'
45

56
interface NavLink {
67
title: string
7-
href: string
8+
href: Route
89
}
910

1011
export const navLinks: NavLink[] = [

0 commit comments

Comments
 (0)