proxy bug fix

This commit is contained in:
2025-02-26 16:13:33 +05:30
parent d241b04fed
commit 0b9f941cb3

View File

@@ -17,14 +17,15 @@ export async function mailProxyRoutes(fastify: FastifyInstance) {
const input = req.body as ProxyRequest;
try {
const tokens = await getOutlookTokens(input.id);
if (!tokens) return res.code(404).send({ error: "resource not found" });
const access_token = await getOutlookTokens(input.id);
if (!access_token)
return res.code(404).send({ error: "resource not found" });
const result = await axios({
url: input.url,
method: input.method,
headers: {
Authorization: "Bearer " + tokens.access_token,
Authorization: "Bearer " + access_token,
},
data: input.body,
validateStatus: () => true,