summary refs log tree commit diff
path: root/src/api/routes/users
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2026-03-14 06:13:32 +0100
committerRory& <root@rory.gay>2026-03-14 06:13:32 +0100
commit0b1d12d968e8d65d94acf0f9c5edfd10fb8aadda (patch)
treee6af3398baec63771a48e0492cd3630de59fa6ab /src/api/routes/users
parentRemove array global pollution (diff)
downloadserver-ts-0b1d12d968e8d65d94acf0f9c5edfd10fb8aadda.tar.xz
Some minor work
Diffstat (limited to 'src/api/routes/users')
-rw-r--r--src/api/routes/users/@me/billing/country-code.ts7
-rw-r--r--src/api/routes/users/@me/billing/location-info.ts7
2 files changed, 8 insertions, 6 deletions
diff --git a/src/api/routes/users/@me/billing/country-code.ts b/src/api/routes/users/@me/billing/country-code.ts

index dd2be6d4..7b90f121 100644 --- a/src/api/routes/users/@me/billing/country-code.ts +++ b/src/api/routes/users/@me/billing/country-code.ts
@@ -18,12 +18,13 @@ import { Request, Response, Router } from "express"; import { route } from "@spacebar/api"; +import { IpDataClient } from "@spacebar/util*"; const router: Router = Router({ mergeParams: true }); -router.get("/", route({}), (req: Request, res: Response) => { - //TODO - res.json({ country_code: "US" }).status(200); +router.get("/", route({}), async (req: Request, res: Response) => { + const country_code = (await IpDataClient.getIpInfo(req.ip!))?.country_code; + res.json({ country_code: country_code }).status(200); }); export default router; diff --git a/src/api/routes/users/@me/billing/location-info.ts b/src/api/routes/users/@me/billing/location-info.ts
index 5a57c0ea..21dfda97 100644 --- a/src/api/routes/users/@me/billing/location-info.ts +++ b/src/api/routes/users/@me/billing/location-info.ts
@@ -18,13 +18,14 @@ import { Request, Response, Router } from "express"; import { route } from "@spacebar/api"; +import { IpDataClient } from "@spacebar/util*"; const router: Router = Router({ mergeParams: true }); -router.get("/", route({}), (req: Request, res: Response) => { - //TODO +router.get("/", route({}), async (req: Request, res: Response) => { // TODO: subdivision_code (optional) - res.json({ country_code: "US" }).status(200); + const country_code = (await IpDataClient.getIpInfo(req.ip!))?.country_code; + res.json({ country_code: country_code }).status(200); }); export default router;