Skip to content

Commit

Permalink
proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
s-alad committed Apr 4, 2024
1 parent 0b9ea55 commit e30cac4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion client/pages/api/me.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import type { NextApiRequest, NextApiResponse } from 'next'
import axios from 'axios';
import { getAuthHeaders } from '@/utils/authHeaders';
import { PROXY } from '@/utils/constants';

export default async function handler(req: NextApiRequest, res: NextApiResponse) {
let authorization_token = req.body.token;
console.log("me");
console.log(authorization_token);

return axios.request({
url: "https://mobile.bereal.com/api" + "/person/me",
url: `${PROXY}https://mobile.bereal.com/api` + "/person/me",
method: "GET",
headers: getAuthHeaders(req.body.token),
}).then(
Expand Down
4 changes: 3 additions & 1 deletion client/utils/myself.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import axios from "axios";

export default async function myself() {

console.log("setting myself");

let token = localStorage.getItem("token");
let body = JSON.stringify({ "token": token });

Expand All @@ -14,7 +16,7 @@ export default async function myself() {

return axios.request(options).then(
(response) => {
console.log(response.data);
console.log("me resp", response.data);
let myselfobject = response.data;
localStorage.setItem("myself", JSON.stringify(myselfobject));
return true
Expand Down

0 comments on commit e30cac4

Please sign in to comment.