mirror of
https://github.com/r-freeman/portfolio.git
synced 2025-04-12 01:54:31 +00:00
Update nextjs and other dependencies
This commit is contained in:
parent
24acc69d20
commit
62e1d50585
@ -1,13 +1,11 @@
|
||||
import {NextResponse} from 'next/server'
|
||||
import {cookies} from 'next/headers'
|
||||
import {createServerComponentClient} from '@supabase/auth-helpers-nextjs'
|
||||
import type {Database} from '@/types/database.types'
|
||||
import {createClient} from '@/lib/supabase/server'
|
||||
|
||||
export async function GET(request: Request, {params}: { params: { slug: string } }) {
|
||||
if (typeof params.slug !== 'undefined') {
|
||||
const {slug} = await params
|
||||
if (typeof slug !== 'undefined') {
|
||||
try {
|
||||
const supabase = createServerComponentClient<Database>({cookies})
|
||||
const slug = params.slug.toString()
|
||||
const supabase = await createClient()
|
||||
const response = await supabase
|
||||
// @ts-ignore
|
||||
.from('analytics')
|
||||
@ -27,10 +25,10 @@ export async function GET(request: Request, {params}: { params: { slug: string }
|
||||
}
|
||||
|
||||
export async function POST(request: Request, {params}: { params: { slug: string } }) {
|
||||
if (typeof params.slug !== 'undefined') {
|
||||
const {slug} = await params
|
||||
if (typeof slug !== 'undefined') {
|
||||
try {
|
||||
const supabase = createServerComponentClient<Database>({cookies})
|
||||
const slug = params.slug.toString()
|
||||
const supabase = await createClient()
|
||||
// @ts-ignore
|
||||
await supabase.rpc('increment_views', {page_slug: slug})
|
||||
return NextResponse.json({})
|
||||
|
@ -1,10 +1,10 @@
|
||||
'use client'
|
||||
|
||||
import {createPagesBrowserClient} from '@supabase/auth-helpers-nextjs'
|
||||
import {ElementType, useEffect} from 'react'
|
||||
import useSWR, {useSWRConfig} from 'swr'
|
||||
import fetcher from '@/lib/fetcher'
|
||||
import {numberFormat} from '@/lib/numberFormat'
|
||||
import {createClient} from '@/lib/supabase/client'
|
||||
|
||||
type ViewsProps = {
|
||||
as?: ElementType
|
||||
@ -15,7 +15,7 @@ type ViewsProps = {
|
||||
}
|
||||
|
||||
export function Views({as: Component = 'span', slug, className, shouldUpdateViews = true, shouldRender = true}: ViewsProps) {
|
||||
const supabase = createPagesBrowserClient()
|
||||
const supabase = createClient()
|
||||
const {data} = useSWR(`/api/views/${slug}`, fetcher) as { data: { views: number } }
|
||||
const {mutate} = useSWRConfig()
|
||||
|
||||
|
1898
package-lock.json
generated
1898
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
13
package.json
13
package.json
@ -16,7 +16,8 @@
|
||||
"@mdx-js/react": "^2.3.0",
|
||||
"@next/mdx": "^13.4.10",
|
||||
"@supabase/auth-helpers-nextjs": "^0.7.3",
|
||||
"@supabase/supabase-js": "^2.27.0",
|
||||
"@supabase/ssr": "^0.5.2",
|
||||
"@supabase/supabase-js": "2.48.1",
|
||||
"@tailwindcss/typography": "^0.5.8",
|
||||
"@theguild/remark-mermaid": "^0.1.2",
|
||||
"@types/mdx": "^2.0.5",
|
||||
@ -28,16 +29,16 @@
|
||||
"clsx": "^1.2.1",
|
||||
"encoding": "^0.1.13",
|
||||
"eslint": "8.31.0",
|
||||
"eslint-config-next": "^14.1.0",
|
||||
"eslint-config-next": "^15.1.7",
|
||||
"fast-glob": "^3.2.12",
|
||||
"feed": "^4.2.2",
|
||||
"focus-visible": "^5.2.0",
|
||||
"next": "^14.2.10",
|
||||
"next": "^15.1.7",
|
||||
"next-themes": "^0.2.1",
|
||||
"postcss": "^8.4.21",
|
||||
"postcss-focus-visible": "^7.1.0",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react": "^19.0.0",
|
||||
"react-dom": "^19.0.0",
|
||||
"remark-gfm": "^3.0.1",
|
||||
"sharp": "^0.33.2",
|
||||
"supabase": "^1.50.2",
|
||||
@ -45,6 +46,6 @@
|
||||
"tailwind-merge": "^1.9.0",
|
||||
"tailwindcss": "^3.3.0",
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "4.9.4"
|
||||
"typescript": "5.7.3"
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user