File tree 11 files changed +61
-61
lines changed
11 files changed +61
-61
lines changed Original file line number Diff line number Diff line change 2
2
3
3
import { NextResponse } from 'next/server'
4
4
5
- import { getServerSession } from "next-auth/next"
6
-
7
- import { authOptions } from "../auth/[...nextauth]/route"
5
+ import { getToken } from 'next-auth/jwt'
8
6
9
7
import prisma from '@/app/lib/prisma'
10
8
11
9
export async function GET ( req ) {
12
- const session = await getServerSession ( req , { req } , authOptions )
10
+ const token = await getToken ( { req, secret : process . env . NEXTAUTH_SECRET } )
11
+
12
+ console . log ( 'Token:' , token )
13
13
14
- if ( ! session ) {
14
+ if ( ! token ) {
15
15
console . log ( 'Unauthorized Access : API Dashboard Admin' )
16
16
17
17
return NextResponse . json ( { error : 'Unauthorized Access' } , { status : 401 } )
Original file line number Diff line number Diff line change 2
2
3
3
import { NextResponse } from 'next/server'
4
4
5
- import { getServerSession } from "next-auth/next"
6
-
7
- import { authOptions } from "../auth/[...nextauth]/route"
5
+ import { getToken } from 'next-auth/jwt'
8
6
9
7
import prisma from '@/app/lib/prisma'
10
8
11
9
export async function GET ( req ) {
12
- const session = await getServerSession ( req , { req } , authOptions )
13
-
14
- if ( ! session ) {
10
+ const token = await getToken ( { req, secret : process . env . NEXTAUTH_SECRET } )
11
+
12
+ console . log ( 'Token:' , token )
13
+
14
+ if ( ! token ) {
15
15
console . log ( 'Unauthorized Access : API Dashboard Karyawan' )
16
16
17
17
return NextResponse . json ( { error : 'Unauthorized Access' } , { status : 401 } )
Original file line number Diff line number Diff line change 3
3
4
4
import { NextResponse } from "next/server"
5
5
6
- import { getServerSession } from "next-auth/next"
7
-
8
- import { authOptions } from "../auth/[...nextauth]/route"
6
+ import { getToken } from 'next-auth/jwt'
9
7
10
8
import prisma from "@/app/lib/prisma"
11
9
12
10
export async function GET ( req ) {
13
- const session = await getServerSession ( req , { req } , authOptions )
11
+ const token = await getToken ( { req, secret : process . env . NEXTAUTH_SECRET } )
12
+
13
+ console . log ( 'Token:' , token )
14
14
15
- if ( ! session ) {
16
- console . log ( 'Unauthorized Access : API Detail Kasbon' )
15
+ if ( ! token ) {
16
+ console . log ( 'Unauthorized Access : API Ambil Detail Kasbon' )
17
17
18
18
return NextResponse . json ( { error : 'Unauthorized Access' } , { status : 401 } )
19
19
}
Original file line number Diff line number Diff line change 3
3
4
4
import { NextResponse } from "next/server"
5
5
6
- import { getServerSession } from "next-auth/next"
7
-
8
- import { authOptions } from "../auth/[...nextauth]/route"
6
+ import { getToken } from 'next-auth/jwt'
9
7
10
8
import prisma from "@/app/lib/prisma"
11
9
12
10
export async function GET ( req ) {
13
- const session = await getServerSession ( req , { req } , authOptions )
11
+ const token = await getToken ( { req, secret : process . env . NEXTAUTH_SECRET } )
12
+
13
+ console . log ( 'Token:' , token )
14
14
15
- if ( ! session ) {
16
- console . log ( 'Unauthorized Access : API Ambil Kasbon Bayar' )
15
+ if ( ! token ) {
16
+ console . log ( 'Unauthorized Access : API Ambil Status Bayar' )
17
17
18
18
return NextResponse . json ( { error : 'Unauthorized Access' } , { status : 401 } )
19
19
}
Original file line number Diff line number Diff line change 3
3
4
4
import { NextResponse } from "next/server"
5
5
6
- import { getServerSession } from "next-auth/next"
7
-
8
- import { authOptions } from "../auth/[...nextauth]/route"
6
+ import { getToken } from 'next-auth/jwt'
9
7
10
8
import prisma from "@/app/lib/prisma"
11
9
12
10
export async function GET ( req ) {
13
- const session = await getServerSession ( req , { req } , authOptions )
11
+ const token = await getToken ( { req, secret : process . env . NEXTAUTH_SECRET } )
12
+
13
+ console . log ( 'Token:' , token )
14
14
15
- if ( ! session ) {
16
- console . log ( 'Unauthorized Access : API Ambil Kasbon Request' )
15
+ if ( ! token ) {
16
+ console . log ( 'Unauthorized Access : API Ambil Status Request' )
17
17
18
18
return NextResponse . json ( { error : 'Unauthorized Access' } , { status : 401 } )
19
19
}
Original file line number Diff line number Diff line change @@ -6,17 +6,17 @@ import { NextResponse } from "next/server"
6
6
7
7
import dayjs from 'dayjs'
8
8
9
- import { getServerSession } from "next-auth/next"
10
-
11
- import { authOptions } from "../auth/[...nextauth]/route"
9
+ import { getToken } from 'next-auth/jwt'
12
10
13
11
import prisma from "@/app/lib/prisma"
14
12
15
13
export async function GET ( req ) {
16
- const session = await getServerSession ( req , { req } , authOptions )
14
+ const token = await getToken ( { req, secret : process . env . NEXTAUTH_SECRET } )
15
+
16
+ console . log ( 'Token:' , token )
17
17
18
- if ( ! session ) {
19
- console . log ( 'Unauthorized Access : API Ambil Laporan Bulanan' )
18
+ if ( ! token ) {
19
+ console . log ( 'Unauthorized Access : API Ambil Laporan Bulanan Kasbon ' )
20
20
21
21
return NextResponse . json ( { error : 'Unauthorized Access' } , { status : 401 } )
22
22
}
Original file line number Diff line number Diff line change @@ -2,16 +2,16 @@ import { NextResponse } from 'next/server'
2
2
3
3
import bcrypt from 'bcrypt'
4
4
5
- import { getServerSession } from "next-auth/next"
6
-
7
- import { authOptions } from "../auth/[...nextauth]/route"
5
+ import { getToken } from 'next-auth/jwt'
8
6
9
7
import prisma from '@/app/lib/prisma'
10
8
11
9
export const POST = async ( req ) => {
12
- const session = await getServerSession ( req , { req } , authOptions )
10
+ const token = await getToken ( { req, secret : process . env . NEXTAUTH_SECRET } )
11
+
12
+ console . log ( 'Token:' , token )
13
13
14
- if ( ! session ) {
14
+ if ( ! token ) {
15
15
console . log ( 'Unauthorized Access : API Registrasi Akun' )
16
16
17
17
return NextResponse . json ( { error : 'Unauthorized Access' } , { status : 401 } )
Original file line number Diff line number Diff line change 3
3
4
4
import { NextResponse } from "next/server"
5
5
6
- import { getServerSession } from "next-auth/next"
7
-
8
- import { authOptions } from "../auth/[...nextauth]/route"
6
+ import { getToken } from 'next-auth/jwt'
9
7
10
8
import prisma from "@/app/lib/prisma"
11
9
12
10
export const PUT = async ( req ) => {
13
- const session = await getServerSession ( req , { req } , authOptions )
11
+ const token = await getToken ( { req, secret : process . env . NEXTAUTH_SECRET } )
12
+
13
+ console . log ( 'Token:' , token )
14
14
15
- if ( ! session ) {
15
+ if ( ! token ) {
16
16
console . log ( 'Unauthorized Access : API SET Status Bayar' )
17
17
18
18
return NextResponse . json ( { error : 'Unauthorized Access' } , { status : 401 } )
Original file line number Diff line number Diff line change 3
3
4
4
import { NextResponse } from "next/server"
5
5
6
- import { getServerSession } from "next-auth/next"
7
-
8
- import { authOptions } from "../auth/[...nextauth]/route"
6
+ import { getToken } from 'next-auth/jwt'
9
7
10
8
import prisma from "@/app/lib/prisma"
11
9
12
10
export const PUT = async ( req ) => {
13
- const session = await getServerSession ( req , { req } , authOptions )
11
+ const token = await getToken ( { req, secret : process . env . NEXTAUTH_SECRET } )
12
+
13
+ console . log ( 'Token:' , token )
14
14
15
- if ( ! session ) {
16
- console . log ( 'Unauthorized Access : API SET Status Request' )
15
+ if ( ! token ) {
16
+ console . log ( 'Unauthorized Access : API Set Status Request' )
17
17
18
18
return NextResponse . json ( { error : 'Unauthorized Access' } , { status : 401 } )
19
19
}
Original file line number Diff line number Diff line change 1
1
import { NextResponse } from 'next/server'
2
2
3
- import { getServerSession } from "next-auth/next"
4
-
5
- import { authOptions } from "../auth/[...nextauth]/route"
3
+ import { getToken } from 'next-auth/jwt'
6
4
7
5
import prisma from '@/app/lib/prisma'
8
6
9
7
10
8
// GET /api/tabel-akun
11
9
export async function GET ( req ) {
12
- const session = await getServerSession ( req , { req } , authOptions )
10
+ const token = await getToken ( { req, secret : process . env . NEXTAUTH_SECRET } )
11
+
12
+ console . log ( 'Token:' , token )
13
13
14
- if ( ! session ) {
14
+ if ( ! token ) {
15
15
console . log ( 'Unauthorized Access : API Ambil Daftar Akun' )
16
16
17
17
return NextResponse . json ( { error : 'Unauthorized Access' } , { status : 401 } )
Original file line number Diff line number Diff line change 2
2
3
3
import { NextResponse } from 'next/server'
4
4
5
- import { getServerSession } from "next-auth/next"
6
-
7
- import { authOptions } from "../auth/[...nextauth]/route"
5
+ import { getToken } from 'next-auth/jwt'
8
6
9
7
import prisma from '@/app/lib/prisma'
10
8
11
9
export const POST = async ( req ) => {
12
- const session = await getServerSession ( req , { req } , authOptions )
10
+ const token = await getToken ( { req, secret : process . env . NEXTAUTH_SECRET } )
11
+
12
+ console . log ( 'Token:' , token )
13
13
14
- if ( ! session ) {
14
+ if ( ! token ) {
15
15
console . log ( 'Unauthorized Access : API Tambah Kasbon' )
16
16
17
17
return NextResponse . json ( { error : 'Unauthorized Access' } , { status : 401 } )
You can’t perform that action at this time.
0 commit comments