chore: Rename createAuthLink as createAuthData

This commit is contained in:
Faruk AYDIN
2021-10-26 21:52:04 +02:00
committed by Ali BARIN
parent 901699fe64
commit cbfba465db
15 changed files with 43 additions and 43 deletions

View File

@@ -22,7 +22,7 @@ export default class Discord {
return this.appData.fields.find((field: Field) => field.key == 'oAuthRedirectUrl').value; return this.appData.fields.find((field: Field) => field.key == 'oAuthRedirectUrl').value;
} }
async createAuthLink() { async createAuthData() {
const searchParams = new URLSearchParams({ const searchParams = new URLSearchParams({
client_id: this.connectionData.consumerKey, client_id: this.connectionData.consumerKey,
redirect_uri: this.oauthRedirectUrl, redirect_uri: this.oauthRedirectUrl,

View File

@@ -71,7 +71,7 @@
{ {
"step": 2, "step": 2,
"type": "mutation", "type": "mutation",
"name": "createAuthLink", "name": "createAuthData",
"fields": [ "fields": [
{ {
"name": "id", "name": "id",
@@ -86,7 +86,7 @@
"fields": [ "fields": [
{ {
"name": "url", "name": "url",
"value": "{createAuthLink.url}" "value": "{createAuthData.url}"
} }
] ]
}, },
@@ -163,7 +163,7 @@
{ {
"step": 3, "step": 3,
"type": "mutation", "type": "mutation",
"name": "createAuthLink", "name": "createAuthData",
"fields": [ "fields": [
{ {
"name": "id", "name": "id",
@@ -178,7 +178,7 @@
"fields": [ "fields": [
{ {
"name": "url", "name": "url",
"value": "{createAuthLink.url}" "value": "{createAuthData.url}"
} }
] ]
}, },

View File

@@ -31,7 +31,7 @@ export default class Firebase {
return this.appData.fields.find((field: Field) => field.key == 'oAuthRedirectUrl').value; return this.appData.fields.find((field: Field) => field.key == 'oAuthRedirectUrl').value;
} }
async createAuthLink() { async createAuthData() {
const url = this.oauthClient.generateAuthUrl({ const url = this.oauthClient.generateAuthUrl({
access_type: 'offline', access_type: 'offline',
scope: this.scopes scope: this.scopes

View File

@@ -71,7 +71,7 @@
{ {
"step": 2, "step": 2,
"type": "mutation", "type": "mutation",
"name": "createAuthLink", "name": "createAuthData",
"fields": [ "fields": [
{ {
"name": "id", "name": "id",
@@ -86,7 +86,7 @@
"fields": [ "fields": [
{ {
"name": "url", "name": "url",
"value": "{createAuthLink.url}" "value": "{createAuthData.url}"
} }
] ]
}, },
@@ -163,7 +163,7 @@
{ {
"step": 3, "step": 3,
"type": "mutation", "type": "mutation",
"name": "createAuthLink", "name": "createAuthData",
"fields": [ "fields": [
{ {
"name": "id", "name": "id",
@@ -178,7 +178,7 @@
"fields": [ "fields": [
{ {
"name": "url", "name": "url",
"value": "{createAuthLink.url}" "value": "{createAuthData.url}"
} }
] ]
}, },

View File

@@ -26,7 +26,7 @@ export default class Flickr {
this.appData = App.findOneByKey('flickr'); this.appData = App.findOneByKey('flickr');
} }
async createAuthLink() { async createAuthData() {
const appFields = this.appData.fields.find((field: Field) => field.key == 'oAuthRedirectUrl') const appFields = this.appData.fields.find((field: Field) => field.key == 'oAuthRedirectUrl')
const callbackUrl = appFields.value; const callbackUrl = appFields.value;

View File

@@ -71,7 +71,7 @@
{ {
"step": 2, "step": 2,
"type": "mutation", "type": "mutation",
"name": "createAuthLink", "name": "createAuthData",
"fields": [ "fields": [
{ {
"name": "id", "name": "id",
@@ -86,7 +86,7 @@
"fields": [ "fields": [
{ {
"name": "url", "name": "url",
"value": "{createAuthLink.url}" "value": "{createAuthData.url}"
} }
] ]
}, },
@@ -163,7 +163,7 @@
{ {
"step": 3, "step": 3,
"type": "mutation", "type": "mutation",
"name": "createAuthLink", "name": "createAuthData",
"fields": [ "fields": [
{ {
"name": "id", "name": "id",
@@ -178,7 +178,7 @@
"fields": [ "fields": [
{ {
"name": "url", "name": "url",
"value": "{createAuthLink.url}" "value": "{createAuthData.url}"
} }
] ]
}, },

View File

@@ -36,7 +36,7 @@ export default class Twitch {
return this.appData.fields.find((field: Field) => field.key == 'oAuthRedirectUrl').value; return this.appData.fields.find((field: Field) => field.key == 'oAuthRedirectUrl').value;
} }
async createAuthLink() { async createAuthData() {
const { url } = await fetchUtil('https://id.twitch.tv/oauth2/authorize', { const { url } = await fetchUtil('https://id.twitch.tv/oauth2/authorize', {
search: { search: {
client_id: this.connectionData.consumerKey, client_id: this.connectionData.consumerKey,

View File

@@ -71,7 +71,7 @@
{ {
"step": 2, "step": 2,
"type": "mutation", "type": "mutation",
"name": "createAuthLink", "name": "createAuthData",
"fields": [ "fields": [
{ {
"name": "id", "name": "id",
@@ -86,7 +86,7 @@
"fields": [ "fields": [
{ {
"name": "url", "name": "url",
"value": "{createAuthLink.url}" "value": "{createAuthData.url}"
} }
] ]
}, },
@@ -163,7 +163,7 @@
{ {
"step": 3, "step": 3,
"type": "mutation", "type": "mutation",
"name": "createAuthLink", "name": "createAuthData",
"fields": [ "fields": [
{ {
"name": "id", "name": "id",
@@ -178,7 +178,7 @@
"fields": [ "fields": [
{ {
"name": "url", "name": "url",
"value": "{createAuthLink.url}" "value": "{createAuthData.url}"
} }
] ]
}, },

View File

@@ -19,7 +19,7 @@ export default class Twitter {
this.appData = App.findOneByKey('twitter'); this.appData = App.findOneByKey('twitter');
} }
async createAuthLink() { async createAuthData() {
const appFields = this.appData.fields.find((field: Field) => field.key == 'oAuthRedirectUrl') const appFields = this.appData.fields.find((field: Field) => field.key == 'oAuthRedirectUrl')
const callbackUrl = appFields.value; const callbackUrl = appFields.value;

View File

@@ -71,7 +71,7 @@
{ {
"step": 2, "step": 2,
"type": "mutation", "type": "mutation",
"name": "createAuthLink", "name": "createAuthData",
"fields": [ "fields": [
{ {
"name": "id", "name": "id",
@@ -86,7 +86,7 @@
"fields": [ "fields": [
{ {
"name": "url", "name": "url",
"value": "{createAuthLink.url}" "value": "{createAuthData.url}"
} }
] ]
}, },
@@ -163,7 +163,7 @@
{ {
"step": 3, "step": 3,
"type": "mutation", "type": "mutation",
"name": "createAuthLink", "name": "createAuthData",
"fields": [ "fields": [
{ {
"name": "id", "name": "id",
@@ -178,7 +178,7 @@
"fields": [ "fields": [
{ {
"name": "url", "name": "url",
"value": "{createAuthLink.url}" "value": "{createAuthData.url}"
} }
] ]
}, },

View File

@@ -6,7 +6,7 @@ import RequestWithCurrentUser from '../../types/express/request-with-current-use
type Params = { type Params = {
id: number, id: number,
} }
const createAuthLinkResolver = async (params: Params, req: RequestWithCurrentUser) => { const createAuthDataResolver = async (params: Params, req: RequestWithCurrentUser) => {
const connection = await Connection.query().findOne({ const connection = await Connection.query().findOne({
user_id: req.currentUser.id, user_id: req.currentUser.id,
id: params.id id: params.id
@@ -19,7 +19,7 @@ const createAuthLinkResolver = async (params: Params, req: RequestWithCurrentUse
consumerSecret: connection.data.consumerSecret consumerSecret: connection.data.consumerSecret
}); });
const authLink = await appInstance.createAuthLink(); const authLink = await appInstance.createAuthData();
await connection.$query().patch({ await connection.$query().patch({
data: { data: {
@@ -31,12 +31,12 @@ const createAuthLinkResolver = async (params: Params, req: RequestWithCurrentUse
return authLink; return authLink;
} }
const createAuthLink = { const createAuthData = {
type: authLinkType, type: authLinkType,
args: { args: {
id: { type: GraphQLNonNull(GraphQLString) }, id: { type: GraphQLNonNull(GraphQLString) },
}, },
resolve: (_: any, params: Params, req: RequestWithCurrentUser) => createAuthLinkResolver(params, req) resolve: (_: any, params: Params, req: RequestWithCurrentUser) => createAuthDataResolver(params, req)
}; };
export default createAuthLink; export default createAuthData;

View File

@@ -1,6 +1,6 @@
import { GraphQLObjectType } from 'graphql'; import { GraphQLObjectType } from 'graphql';
import createConnection from './mutations/create-connection'; import createConnection from './mutations/create-connection';
import createAuthLink from './mutations/create-auth-link'; import createAuthData from './mutations/create-auth-data';
import updateConnection from './mutations/update-connection'; import updateConnection from './mutations/update-connection';
import resetConnection from './mutations/reset-connection'; import resetConnection from './mutations/reset-connection';
import verifyConnection from './mutations/verify-connection'; import verifyConnection from './mutations/verify-connection';
@@ -10,7 +10,7 @@ const rootMutation = new GraphQLObjectType({
name: 'Mutation', name: 'Mutation',
fields: { fields: {
createConnection, createConnection,
createAuthLink, createAuthData,
updateConnection, updateConnection,
resetConnection, resetConnection,
verifyConnection, verifyConnection,

View File

@@ -0,0 +1,9 @@
import { gql } from '@apollo/client';
export const CREATE_AUTH_DATA = gql`
mutation createAuthData($id: String!) {
createAuthData(id: $id) {
url
}
}
`;

View File

@@ -1,9 +0,0 @@
import { gql } from '@apollo/client';
export const CREATE_AUTH_LINK = gql`
mutation CreateAuthLink($id: String!) {
createAuthLink(id: $id) {
url
}
}
`;

View File

@@ -3,7 +3,7 @@ import { UPDATE_CONNECTION } from './update-connection';
import { VERIFY_CONNECTION } from './verify-connection'; import { VERIFY_CONNECTION } from './verify-connection';
import { RESET_CONNECTION } from './reset-connection'; import { RESET_CONNECTION } from './reset-connection';
import { DELETE_CONNECTION } from './delete-connection'; import { DELETE_CONNECTION } from './delete-connection';
import { CREATE_AUTH_LINK } from './create-auth-link'; import { CREATE_AUTH_DATA } from './create-auth-data';
type Mutations = { type Mutations = {
[key: string]: any, [key: string]: any,
@@ -15,7 +15,7 @@ const mutations: Mutations = {
verifyConnection: VERIFY_CONNECTION, verifyConnection: VERIFY_CONNECTION,
resetConnection: RESET_CONNECTION, resetConnection: RESET_CONNECTION,
deleteConnection: DELETE_CONNECTION, deleteConnection: DELETE_CONNECTION,
createAuthLink: CREATE_AUTH_LINK, createAuthData: CREATE_AUTH_DATA,
}; };
export default mutations; export default mutations;