fix: create a trpc route for fetching country (#7555)
* fix: create a trpc route for fetching country Signed-off-by: Udit Takkar <[email protected]> * fix: type error Signed-off-by: Udit Takkar <[email protected]> --------- Signed-off-by: Udit Takkar <[email protected]> Co-authored-by: Peer Richelsen <[email protected]> Co-authored-by: Alex van Andel <[email protected]>
This commit is contained in:
3 files changed
+16
-31
No files matched your search
@@ -1,20 +0,0 @@
|
||||
import type { NextRequest } from "next/server";
|
||||
|
||||
export const config = {
|
||||
runtime: "edge",
|
||||
};
|
||||
|
||||
export default async function handler(req: NextRequest) {
|
||||
const countryCode = req.headers.get("x-vercel-ip-country") ?? "";
|
||||
return new Response(
|
||||
JSON.stringify({
|
||||
countryCode,
|
||||
}),
|
||||
{
|
||||
status: 200,
|
||||
headers: {
|
||||
"content-type": "application/json",
|
||||
},
|
||||
}
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user