feat(group): edit group
This commit is contained in:
@@ -119,44 +119,52 @@ export async function POST(req: any) {
|
||||
},
|
||||
})
|
||||
} else if (!notJson) {
|
||||
const data = await res.json()
|
||||
try {
|
||||
const data = await (res.headers
|
||||
.get("Content-Type")
|
||||
?.includes("application/json")
|
||||
? res.json()
|
||||
: res.text())
|
||||
|
||||
if (isLogin) {
|
||||
const header = await headers()
|
||||
let clientIP =
|
||||
header.get("x-forwarded-for")?.split(",")[0] ||
|
||||
req?.socket?.remoteAddress
|
||||
// ip v6地址
|
||||
if (clientIP.startsWith("::")) {
|
||||
clientIP = clientIP.slice(7)
|
||||
if (isLogin) {
|
||||
const header = await headers()
|
||||
let clientIP =
|
||||
header.get("x-forwarded-for")?.split(",")[0] ||
|
||||
req?.socket?.remoteAddress
|
||||
// ip v6地址
|
||||
if (clientIP.startsWith("::")) {
|
||||
clientIP = clientIP.slice(7)
|
||||
}
|
||||
const newData = await handleLoginData({
|
||||
clientIP: clientIP,
|
||||
fingerprint: body.fingerprint,
|
||||
data,
|
||||
})
|
||||
return new NextResponse(JSON.stringify(newData), {
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
})
|
||||
}
|
||||
const newData = await handleLoginData({
|
||||
clientIP: clientIP,
|
||||
fingerprint: body.fingerprint,
|
||||
data,
|
||||
})
|
||||
return new NextResponse(JSON.stringify(newData), {
|
||||
if (isRefresh) {
|
||||
const newData = await handleRefreshToken({
|
||||
userData,
|
||||
data,
|
||||
})
|
||||
return new NextResponse(JSON.stringify(newData), {
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
})
|
||||
}
|
||||
return new NextResponse(JSON.stringify(data), {
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
})
|
||||
} catch (err) {
|
||||
return NextResponse.json({ error: err }, { status: 500 })
|
||||
}
|
||||
if (isRefresh) {
|
||||
const newData = await handleRefreshToken({
|
||||
userData,
|
||||
data,
|
||||
})
|
||||
return new NextResponse(JSON.stringify(newData), {
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
})
|
||||
}
|
||||
return new NextResponse(JSON.stringify(data), {
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
})
|
||||
} else {
|
||||
return res
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user