proxy bug fix
This commit is contained in:
@@ -17,14 +17,15 @@ export async function mailProxyRoutes(fastify: FastifyInstance) {
|
|||||||
const input = req.body as ProxyRequest;
|
const input = req.body as ProxyRequest;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const tokens = await getOutlookTokens(input.id);
|
const access_token = await getOutlookTokens(input.id);
|
||||||
if (!tokens) return res.code(404).send({ error: "resource not found" });
|
if (!access_token)
|
||||||
|
return res.code(404).send({ error: "resource not found" });
|
||||||
|
|
||||||
const result = await axios({
|
const result = await axios({
|
||||||
url: input.url,
|
url: input.url,
|
||||||
method: input.method,
|
method: input.method,
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: "Bearer " + tokens.access_token,
|
Authorization: "Bearer " + access_token,
|
||||||
},
|
},
|
||||||
data: input.body,
|
data: input.body,
|
||||||
validateStatus: () => true,
|
validateStatus: () => true,
|
||||||
|
|||||||
Reference in New Issue
Block a user