Skip to content

Commit

Permalink
Clean up code after using requestUrl
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Boesen committed Nov 6, 2023
1 parent 20748cd commit 679c142
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/remoteForOnedrive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export const sendAuthReq = async (
authCode: string,
verifier: string
) => {
const rsp1 = await requestUrl({
const rsp = await requestUrl({
url: `${authority}/oauth2/v2.0/token`,
method: "POST",
contentType: "application/x-www-form-urlencoded",
Expand All @@ -120,14 +120,12 @@ export const sendAuthReq = async (
grant_type: "authorization_code",
code_verifier: verifier,
}).toString(),
});

const rsp2 = rsp1.json;
}).json;

if (rsp2.error !== undefined) {
return rsp2 as AccessCodeResponseFailedType;
if (rsp.error !== undefined) {
return rsp as AccessCodeResponseFailedType;
} else {
return rsp2 as AccessCodeResponseSuccessfulType;
return rsp as AccessCodeResponseSuccessfulType;
}
};

Expand Down

0 comments on commit 679c142

Please sign in to comment.