proxy bug fix
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user