Skip to content

Commit

Permalink
Fix redirect to url in middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
pheralb committed Mar 30, 2024
1 parent 883aa2a commit a143ebd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,13 @@ export default auth(async (req) => {
return;
}

const getDataUrl = await getDataApi.json();
const getDataUrl = (await getDataApi.json()) as {
message: string;
url: string;
};

if (getDataUrl?.url) {
return NextResponse.redirect(new URL(getDataUrl.url as string));
return NextResponse.redirect(new URL(getDataUrl.url).toString());
}
} catch (error) {
console.error("🚧 Error fetching slug: ", error);
Expand Down

0 comments on commit a143ebd

Please sign in to comment.