linter fixes
This commit is contained in:
@@ -34,6 +34,7 @@ export async function POST(req: NextRequest) {
|
||||
const result = await response.json()
|
||||
return new Response(JSON.stringify(result), { status: 200 })
|
||||
} catch (error) {
|
||||
console.error('POST /api/account/create-route error:', error)
|
||||
return new Response(JSON.stringify({ error: 'Internal Server Error' }), {
|
||||
status: 500,
|
||||
})
|
||||
|
||||
@@ -39,6 +39,7 @@ export async function PATCH(req: NextRequest) {
|
||||
const result = await response.json()
|
||||
return new Response(JSON.stringify(result), { status: 200 })
|
||||
} catch (error) {
|
||||
console.error('PATCH /api/account/main error:', error)
|
||||
return new Response(JSON.stringify({ error: 'Internal Server Error' }), {
|
||||
status: 500,
|
||||
})
|
||||
|
||||
@@ -2,7 +2,7 @@ import { NextRequest } from 'next/server'
|
||||
import { getServerSession } from 'next-auth'
|
||||
import { authOptions } from '@/app/api/auth/[...nextauth]/route'
|
||||
|
||||
export async function GET(req: NextRequest) {
|
||||
export async function GET() {
|
||||
try {
|
||||
const response = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/plans/`, {
|
||||
method: 'GET',
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { NextRequest } from 'next/server'
|
||||
import { getServerSession } from 'next-auth'
|
||||
import { authOptions } from '@/app/api/auth/[...nextauth]/route'
|
||||
|
||||
export async function GET(req: NextRequest) {
|
||||
export async function GET() {
|
||||
try {
|
||||
const session = await getServerSession(authOptions)
|
||||
if (!session) {
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { NextRequest } from 'next/server'
|
||||
import { getServerSession } from 'next-auth'
|
||||
import { authOptions } from '@/app/api/auth/[...nextauth]/route'
|
||||
|
||||
export async function GET(req: NextRequest) {
|
||||
export async function GET() {
|
||||
try {
|
||||
const session = await getServerSession(authOptions)
|
||||
if (!session) {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import NextAuth, { NextAuthOptions } from 'next-auth'
|
||||
import GoogleProvider from 'next-auth/providers/google'
|
||||
import CredentialsProvider from 'next-auth/providers/credentials'
|
||||
import { JWT } from 'next-auth/jwt'
|
||||
|
||||
@@ -75,21 +74,18 @@ export const authOptions: NextAuthOptions = {
|
||||
throw new Error('Все поля обязательны для заполнения')
|
||||
}
|
||||
|
||||
const res = await fetch(
|
||||
`${process.env.BACKEND_URL}/register/clients/`,
|
||||
{
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
email: credentials.email,
|
||||
password: credentials.password,
|
||||
name: credentials.name,
|
||||
surname: credentials.surname,
|
||||
phone_number: credentials.phone_number,
|
||||
privacy_accepted: credentials.privacy_accepted === 'true',
|
||||
}),
|
||||
}
|
||||
)
|
||||
const res = await fetch(`${process.env.BACKEND_URL}/register/clients/`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
email: credentials.email,
|
||||
password: credentials.password,
|
||||
name: credentials.name,
|
||||
surname: credentials.surname,
|
||||
phone_number: credentials.phone_number,
|
||||
privacy_accepted: credentials.privacy_accepted === 'true',
|
||||
}),
|
||||
})
|
||||
|
||||
const data = await res.json()
|
||||
|
||||
@@ -126,17 +122,14 @@ export const authOptions: NextAuthOptions = {
|
||||
},
|
||||
async authorize(credentials) {
|
||||
try {
|
||||
const res = await fetch(
|
||||
`${process.env.BACKEND_URL}/auth/login/clients/`,
|
||||
{
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
email: credentials?.email,
|
||||
password: credentials?.password,
|
||||
}),
|
||||
}
|
||||
)
|
||||
const res = await fetch(`${process.env.BACKEND_URL}/auth/login/clients/`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
email: credentials?.email,
|
||||
password: credentials?.password,
|
||||
}),
|
||||
})
|
||||
|
||||
const data = await res.json()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user