Skip to content

Commit

Permalink
Bug Fix: Fix wierd issue with import in experimental-app-router
Browse files Browse the repository at this point in the history
  • Loading branch information
theodesp committed Mar 7, 2024
1 parent 4724719 commit ec28eaa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { notFound } from 'next/navigation.js';
import * as server from 'next/server.js';
import { tokenHandler } from './tokenHandler.js';

export async function GetFn(req: Request) {
const { pathname } = new URL(req.url);

switch (pathname) {
case '/api/faust/token': {
return tokenHandler(req);
return tokenHandler(req, server);
}
default: {
return notFound();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { cookies } from 'next/headers.js';
import { NextResponse } from 'next/server.js';
import * as server from 'next/server.js';
import { getWpUrl, getWpSecret } from '../../faust-core-utils.js';

export type AuthorizeResponse = {
Expand All @@ -9,7 +9,7 @@ export type AuthorizeResponse = {
refreshTokenExpiration: number;
};

export async function tokenHandler(req: Request) {
export async function tokenHandler(req: Request, s: typeof server) {
try {
const secretKey = getWpSecret();

Expand Down Expand Up @@ -79,7 +79,7 @@ export async function tokenHandler(req: Request) {
* and expiration.
*/

const res = new NextResponse(JSON.stringify(data), {
const res = new s.NextResponse(JSON.stringify(data), {
status: 200,
});

Expand Down

0 comments on commit ec28eaa

Please sign in to comment.