mirror of
https://github.com/vercel/commerce.git
synced 2025-07-23 04:36:49 +00:00
Dynamic API routes (#836)
* Add dynamic API endpoints * Add missing dependency * Update api handlers * Updates * Fix build errors * Update package.json * Add checkout endpoint parser & update errors * Update tsconfig.json * Update cart.ts * Update parser * Update errors.ts * Update errors.ts * Move to Edge runtime * Revert to local * Fix switchable runtimes * Make nodejs default runtime * Update pnpm-lock.yaml * Update handlers * Fix build errors * Change headers
This commit is contained in:
35
site/components/ui/ErrorMessage/ErrorMessage.tsx
Normal file
35
site/components/ui/ErrorMessage/ErrorMessage.tsx
Normal file
@@ -0,0 +1,35 @@
|
||||
import type { FC } from 'react'
|
||||
import cn from 'clsx'
|
||||
|
||||
interface ErrorMessageProps {
|
||||
error: {
|
||||
message: string
|
||||
code?: string
|
||||
errors?: {
|
||||
message: string
|
||||
}[]
|
||||
}
|
||||
className?: string
|
||||
}
|
||||
|
||||
const ErrorMessages: FC<ErrorMessageProps> = ({ error, className }) => {
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
'flex flex-col text-red py-2.5 px-4 border border-solid border-red',
|
||||
className
|
||||
)}
|
||||
>
|
||||
<span>{error.message}</span>
|
||||
{error.errors && error.errors?.length > 0 && (
|
||||
<ul className="list-disc list-inside">
|
||||
{error.errors.map(({ message }, index) => (
|
||||
<li key={index}>{message}</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default ErrorMessages
|
1
site/components/ui/ErrorMessage/index.ts
Normal file
1
site/components/ui/ErrorMessage/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export { default } from './ErrorMessage'
|
Reference in New Issue
Block a user