Skip to content

Commit

Permalink
fix cors
Browse files Browse the repository at this point in the history
  • Loading branch information
thanhdanh27600 committed May 11, 2024
1 parent b641228 commit 84c83ed
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/controllers/l.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import requestIp from 'request-ip';
import { ipLookup } from '../utils/agent';
import { api, originGuard } from '../utils/axios';
import { api } from '../utils/axios';

export const handler = api(
async (req, res) => {
originGuard(req, res);
const ip = requestIp.getClientIp(req) || '';
const lookupIp = ipLookup(ip) || undefined;
return res.send({ country: lookupIp?.country || '' });
Expand Down
3 changes: 2 additions & 1 deletion src/pages/api/l.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { l } from 'controllers';
import { allowCors } from 'requests/api';
// l = location
export default l.handler;
export default allowCors(l.handler);

0 comments on commit 84c83ed

Please sign in to comment.