Refactoring
This commit is contained in:
parent
39cfada3e8
commit
dd14dfe72e
41 changed files with 866 additions and 742 deletions
13
apps/bridge-frontend/app/_lib/utils.ts
Normal file
13
apps/bridge-frontend/app/_lib/utils.ts
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import { NextRequest } from "next/server";
|
||||
import { Service } from "./service";
|
||||
import { Facebook } from "./facebook";
|
||||
|
||||
const services: Record<string, Service> = {
|
||||
facebook: Facebook,
|
||||
};
|
||||
|
||||
export const getService = (req: NextRequest): Service => {
|
||||
const service = req.nextUrl.pathname.split("/")?.[2] ?? "none";
|
||||
|
||||
return services[service];
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue