Skip to content

Commit

Permalink
fix: route build type
Browse files Browse the repository at this point in the history
  • Loading branch information
huanghanzhilian committed Jan 15, 2024
1 parent dd55e34 commit 93396a8
Show file tree
Hide file tree
Showing 25 changed files with 26 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/api/auth/login/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ const login = apiHandler(
)

export const POST = login
export const dynamic = 'force-dynamic'
1 change: 1 addition & 0 deletions app/api/auth/register/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ const register = apiHandler(
)

export const POST = register
export const dynamic = 'force-dynamic'
1 change: 1 addition & 0 deletions app/api/auth/user/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ const getUertInfo = apiHandler(
)

export const GET = getUertInfo
export const dynamic = 'force-dynamic'
1 change: 1 addition & 0 deletions app/api/banner/[id]/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,4 @@ const _delete = apiHandler(
export const GET = getDetail
export const PUT = update
export const DELETE = _delete
export const dynamic = 'force-dynamic'
1 change: 1 addition & 0 deletions app/api/banner/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,4 @@ const create = apiHandler(

export const GET = getAll
export const POST = create
export const dynamic = 'force-dynamic'
1 change: 1 addition & 0 deletions app/api/category/[id]/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@ const updateCategory = apiHandler(

export const DELETE = deleteCategory
export const PUT = updateCategory
export const dynamic = 'force-dynamic'
1 change: 1 addition & 0 deletions app/api/category/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,4 @@ const createCategory = apiHandler(

export const GET = getCategory
export const POST = createCategory
export const dynamic = 'force-dynamic'
1 change: 1 addition & 0 deletions app/api/details/[id]/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,4 @@ const deleteDetails = apiHandler(
export const GET = getDetails
export const PUT = updateDetails
export const DELETE = deleteDetails
export const dynamic = 'force-dynamic'
1 change: 1 addition & 0 deletions app/api/details/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ const createDetails = apiHandler(

export const GET = getAllDetails
export const POST = createDetails
export const dynamic = 'force-dynamic'
1 change: 1 addition & 0 deletions app/api/order/[id]/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ const updateOrder = apiHandler(

export const PATCH = updateOrder
export const GET = getOrder
export const dynamic = 'force-dynamic'
1 change: 1 addition & 0 deletions app/api/order/list/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ const getOrders = apiHandler(
)

export const GET = getOrders
export const dynamic = 'force-dynamic'
1 change: 1 addition & 0 deletions app/api/order/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,4 @@ const createOrder = apiHandler(

export const GET = getOrders
export const POST = createOrder
export const dynamic = 'force-dynamic'
1 change: 1 addition & 0 deletions app/api/products/[id]/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,4 @@ const deleteProduct = apiHandler(
export const GET = getProduct
export const PUT = updateProduct
export const DELETE = deleteProduct
export const dynamic = 'force-dynamic'
1 change: 1 addition & 0 deletions app/api/products/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,4 @@ const createProduct = apiHandler(

export const GET = getAllProduct
export const POST = createProduct
export const dynamic = 'force-dynamic'
1 change: 1 addition & 0 deletions app/api/reviews/[id]/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,4 @@ const _delete = apiHandler(
export const GET = getDetail
export const PATCH = update
export const DELETE = _delete
export const dynamic = 'force-dynamic'
1 change: 1 addition & 0 deletions app/api/reviews/list/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ const getAll = apiHandler(
)

export const GET = getAll
export const dynamic = 'force-dynamic'
1 change: 1 addition & 0 deletions app/api/reviews/product/[id]/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ const getReviews = apiHandler(
)

export const GET = getReviews
export const dynamic = 'force-dynamic'
1 change: 1 addition & 0 deletions app/api/reviews/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,4 @@ const create = apiHandler(

export const GET = getAll
export const POST = create
export const dynamic = 'force-dynamic'
1 change: 1 addition & 0 deletions app/api/slider/[id]/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,4 @@ const _delete = apiHandler(
export const GET = getDetail
export const PUT = update
export const DELETE = _delete
export const dynamic = 'force-dynamic'
1 change: 1 addition & 0 deletions app/api/slider/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,4 @@ const create = apiHandler(

export const GET = getAll
export const POST = create
export const dynamic = 'force-dynamic'
1 change: 1 addition & 0 deletions app/api/upload/getToken/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ const getToken = apiHandler(
)

export const GET = getToken
export const dynamic = 'force-dynamic'
1 change: 1 addition & 0 deletions app/api/user/[id]/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ const deleteUser = apiHandler(

export const PATCH = updateRole
export const DELETE = deleteUser
export const dynamic = 'force-dynamic'
1 change: 1 addition & 0 deletions app/api/user/reset-password/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ const resetPassword = apiHandler(
)

export const PATCH = resetPassword
export const dynamic = 'force-dynamic'
1 change: 1 addition & 0 deletions app/api/user/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,4 @@ const uploadInfo = apiHandler(

export const GET = getUsers
export const PATCH = uploadInfo
export const dynamic = 'force-dynamic'
3 changes: 2 additions & 1 deletion helpers/auth.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import jwt from 'jsonwebtoken'

const verifyToken = async (req, isJwt) => {
try {
const token = req.headers.get('authorization')
const decoded = jwt.verify(token, process.env.NEXT_PUBLIC_ACCESS_TOKEN_SECRET)
const id = decoded.id
return id
return new Promise(resolve => resolve(id))
} catch (error) {
if (isJwt) {
throw error
Expand Down

0 comments on commit 93396a8

Please sign in to comment.