Skip to content
This repository has been archived by the owner on Dec 7, 2023. It is now read-only.

Commit

Permalink
chore: moving manifest to new app router (#534)
Browse files Browse the repository at this point in the history
Co-authored-by: Nicolas Burtey <[email protected]>
  • Loading branch information
nicolasburtey and Nicolas Burtey authored Aug 21, 2023
1 parent 7636a96 commit e289393
Showing 1 changed file with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
import { NextApiRequest, NextApiResponse } from "next"
import { NextResponse } from "next/server"

export default async function (req: NextApiRequest, res: NextApiResponse) {
const {
query: { username, memo },
} = req
export async function GET(
request: Request,
{ params }: { params: { username: string } },
) {
const username = params.username

const params = new URLSearchParams()
const { searchParams } = new URL(request.url)
const memo = searchParams.get("memo")

let startUrl = `/${username}`

if (memo) {
params.set("memo", memo.toString())
startUrl = `${startUrl}?memo=${memo}`
}

const manifest = {
name: "POS Cash Register",
short_name: `${username} Register`,
description:
"A Bitcoin POS cash register application that connects with the merchant's wallet",
start_url: `/${username}?${params.toString()}`,
start_url: startUrl,
scope: "/",
display: "standalone",
background_color: "#536FF2",
Expand Down Expand Up @@ -66,5 +70,5 @@ export default async function (req: NextApiRequest, res: NextApiResponse) {
],
}

res.status(200).send(JSON.stringify(manifest))
NextResponse.json(manifest)
}

0 comments on commit e289393

Please sign in to comment.