chore: Make createAuthLink mutation more generic

This commit is contained in:
Faruk AYDIN
2021-10-24 20:06:16 +02:00
committed by Ali BARIN
parent 81d5e6d17c
commit 8e91f1f7ed
6 changed files with 19 additions and 13 deletions

View File

@@ -18,16 +18,14 @@ const createAuthLinkResolver = async (params: Params, req: RequestWithCurrentUse
consumerKey: connection.data.consumerKey,
consumerSecret: connection.data.consumerSecret
});
const authLink = await appInstance.createAuthLink();
await connection.$query().patch({
data: {
...connection.data,
url: authLink.url,
accessToken: authLink.oauth_token,
accessSecret: authLink.oauth_token_secret,
},
verified: authLink.oauth_callback_confirmed === 'true' ? true : false
...authLink
}
})
return authLink;

View File

@@ -18,7 +18,8 @@ const verifyConnectionResolver = async (params: Params, req: RequestWithCurrentU
const verifiedCredentials = await appInstance.verifyCredentials();
connection = await connection.$query().patchAndFetch({
data: verifiedCredentials
data: verifiedCredentials,
verified: true
})
return connection;