Skip to content
Merged

UI #37

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .changepacks/changepack_log_URa6hitqbZIeSM3ThRmXA.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"changes":{"packages/core/package.json":"Patch","packages/rsbuild-plugin/package.json":"Patch","packages/webpack-plugin/package.json":"Patch","packages/zod/package.json":"Patch","packages/generator/package.json":"Patch","packages/next-plugin/package.json":"Patch","packages/fetch/package.json":"Patch","packages/hookform/package.json":"Patch","packages/utils/package.json":"Patch","packages/vite-plugin/package.json":"Patch","packages/react-query/package.json":"Patch","packages/ui/package.json":"Minor"},"note":"Implement ui","date":"2026-01-05T04:19:18.456233400Z"}
68 changes: 44 additions & 24 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/next-webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"lint": "next lint"
},
"dependencies": {
"next": "^16.1.0",
"next": "^16.1.1",
"react": "^19.2.3",
"react-dom": "^19.2.3",
"@devup-api/next-plugin": "workspace:*",
Expand Down
5 changes: 4 additions & 1 deletion examples/next/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Metadata } from 'next'
import { Providers } from './providers'

export const metadata: Metadata = {
title: 'Next.js Example - devup-api',
Expand All @@ -12,7 +13,9 @@ export default function RootLayout({
}) {
return (
<html lang="en">
<body>{children}</body>
<body>
<Providers>{children}</Providers>
</body>
</html>
)
}
22 changes: 12 additions & 10 deletions examples/next/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import { createApi, type DevupObject } from '@devup-api/fetch'
import { createQueryClient } from '@devup-api/react-query'
import { ApiCrud } from '@devup-api/ui'
import { schemas } from '@devup-api/zod'
import { Box, Text } from '@devup-ui/react'
import { useEffect } from 'react'
Expand Down Expand Up @@ -37,20 +38,20 @@ export default function Home() {
console.info(data, isLoading, error)

const {
data: data2,
error: error2,
data: _data2,
error: _error2,
mutateAsync,
} = queryClient.useMutation('GET', '/users/{id}', {})
mutateAsync({
params: { id: 1 },
query: {
name: 'John Doe',
},
})

console.info(data2, error2)
// console.info(data2, error2)

useEffect(() => {
mutateAsync({
params: { id: 1 },
query: {
name: 'John Doe',
},
})
api2.get('getUsers2').then((res) => {
console.log(res)
})
Expand Down Expand Up @@ -79,11 +80,12 @@ export default function Home() {
.then((res) => {
console.log(res)
})
}, [])
}, [mutateAsync])
return (
<Box>
<Text>Next.js Example (Turbopack)</Text>
<Box>
<ApiCrud api={'user'} apiClient={api} />
<Box>
<Box>
<Box>
Expand Down
12 changes: 12 additions & 0 deletions examples/next/app/providers.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
'use client'

import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { type ReactNode, useState } from 'react'

export function Providers({ children }: { children: ReactNode }) {
const [queryClient] = useState(() => new QueryClient())

return (
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
)
}
101 changes: 101 additions & 0 deletions examples/next/openapi2.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"post": {
"summary": "Create a new user",
"operationId": "createUser2",
"tags": ["devup:user:create"],
"requestBody": {
"required": true,
"content": {
Expand Down Expand Up @@ -57,6 +58,7 @@
"get": {
"summary": "Get user by ID",
"operationId": "getUserById2",
"tags": ["devup:user:one"],
"parameters": [
{
"name": "id",
Expand All @@ -79,6 +81,80 @@
}
}
}
},
"put": {
"summary": "Update user (full replacement)",
"operationId": "updateUser2",
"tags": ["devup:user:edit"],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "integer"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UpdateUserRequest"
}
}
}
},
"responses": {
"200": {
"description": "User updated",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/User"
}
}
}
}
}
},
"patch": {
"summary": "Patch user (partial update)",
"operationId": "patchUser2",
"tags": ["devup:user:fix"],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "integer"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PatchUserRequest"
}
}
}
},
"responses": {
"200": {
"description": "User patched",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/User"
}
}
}
}
}
}
}
},
Expand Down Expand Up @@ -131,6 +207,31 @@
}
},
"required": ["name", "email"]
},
"UpdateUserRequest": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"email": {
"type": "string",
"format": "email"
}
},
"required": ["name", "email"]
},
"PatchUserRequest": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"email": {
"type": "string",
"format": "email"
}
}
}
}
}
Expand Down
Loading