Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a9115c3

Browse files
committed
refactor: Simplify function parameters and improve logging in Gitee login route
- Removed unnecessary request parameter from GET function in Gitee login route. - Updated console log messages for consistency in language. - Streamlined icon component definitions in Calendar and adjusted color config filtering in Chart. - Simplified action type definitions in use-toast by removing redundant constants.
1 parent aebae1e commit a9115c3

File tree

4 files changed

+11
-20
lines changed

4 files changed

+11
-20
lines changed

app/api/auth/login/gitee/route.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { type NextRequest, NextResponse } from "next/server"
1+
import { NextResponse } from "next/server"
22

3-
export async function GET(request: NextRequest) {
3+
export async function GET() {
44
try {
55
// 确保环境变量存在,否则使用硬编码的值(仅用于开发)
66
const clientId = process.env.GITEE_CLIENT_ID || "5e96ca868817fa1b190d14e20ffd7b19f03f2c9aa6c064dda3bfe9e715ee8dd2"
@@ -14,12 +14,12 @@ export async function GET(request: NextRequest) {
1414
// 构建 Gitee 授权 URL
1515
const authUrl = `https://gitee.com/oauth/authorize?client_id=${clientId}&redirect_uri=${redirectUri}&response_type=code`
1616

17-
console.log("重定向到:", authUrl)
17+
console.log("重定向到", authUrl)
1818

1919
// 重定向到 Gitee 授权页面
2020
return NextResponse.redirect(authUrl)
2121
} catch (error) {
22-
console.error("Gitee 登录路由错误:", error)
22+
console.error("Gitee 登录路由错误", error)
2323

2424
// 返回错误响应而不是重定向
2525
return new NextResponse(

components/ui/calendar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ function Calendar({
5454
...classNames,
5555
}}
5656
components={{
57-
IconLeft: ({ ...props }) => <ChevronLeft className="h-4 w-4" />,
58-
IconRight: ({ ...props }) => <ChevronRight className="h-4 w-4" />,
57+
IconLeft: () => <ChevronLeft className="h-4 w-4" />,
58+
IconRight: () => <ChevronRight className="h-4 w-4" />,
5959
}}
6060
{...props}
6161
/>

components/ui/chart.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ ChartContainer.displayName = "Chart"
6969

7070
const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {
7171
const colorConfig = Object.entries(config).filter(
72-
([_, config]) => config.theme || config.color
72+
([, config]) => config.theme || config.color
7373
)
7474

7575
if (!colorConfig.length) {

components/ui/use-toast.ts

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,37 +15,28 @@ type ToasterToast = ToastProps & {
1515
action?: ToastActionElement
1616
}
1717

18-
const actionTypes = {
19-
ADD_TOAST: "ADD_TOAST",
20-
UPDATE_TOAST: "UPDATE_TOAST",
21-
DISMISS_TOAST: "DISMISS_TOAST",
22-
REMOVE_TOAST: "REMOVE_TOAST",
23-
} as const
24-
2518
let count = 0
2619

2720
function genId() {
2821
count = (count + 1) % Number.MAX_VALUE
2922
return count.toString()
3023
}
3124

32-
type ActionType = typeof actionTypes
33-
3425
type Action =
3526
| {
36-
type: ActionType["ADD_TOAST"]
27+
type: "ADD_TOAST"
3728
toast: ToasterToast
3829
}
3930
| {
40-
type: ActionType["UPDATE_TOAST"]
31+
type: "UPDATE_TOAST"
4132
toast: Partial<ToasterToast>
4233
}
4334
| {
44-
type: ActionType["DISMISS_TOAST"]
35+
type: "DISMISS_TOAST"
4536
toastId?: string
4637
}
4738
| {
48-
type: ActionType["REMOVE_TOAST"]
39+
type: "REMOVE_TOAST"
4940
toastId?: string
5041
}
5142

0 commit comments

Comments
 (0)