chore: Rename createAuthLink as createAuthData
This commit is contained in:
@@ -22,7 +22,7 @@ export default class Discord {
|
||||
return this.appData.fields.find((field: Field) => field.key == 'oAuthRedirectUrl').value;
|
||||
}
|
||||
|
||||
async createAuthLink() {
|
||||
async createAuthData() {
|
||||
const searchParams = new URLSearchParams({
|
||||
client_id: this.connectionData.consumerKey,
|
||||
redirect_uri: this.oauthRedirectUrl,
|
||||
|
@@ -71,7 +71,7 @@
|
||||
{
|
||||
"step": 2,
|
||||
"type": "mutation",
|
||||
"name": "createAuthLink",
|
||||
"name": "createAuthData",
|
||||
"fields": [
|
||||
{
|
||||
"name": "id",
|
||||
@@ -86,7 +86,7 @@
|
||||
"fields": [
|
||||
{
|
||||
"name": "url",
|
||||
"value": "{createAuthLink.url}"
|
||||
"value": "{createAuthData.url}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -163,7 +163,7 @@
|
||||
{
|
||||
"step": 3,
|
||||
"type": "mutation",
|
||||
"name": "createAuthLink",
|
||||
"name": "createAuthData",
|
||||
"fields": [
|
||||
{
|
||||
"name": "id",
|
||||
@@ -178,7 +178,7 @@
|
||||
"fields": [
|
||||
{
|
||||
"name": "url",
|
||||
"value": "{createAuthLink.url}"
|
||||
"value": "{createAuthData.url}"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@@ -31,7 +31,7 @@ export default class Firebase {
|
||||
return this.appData.fields.find((field: Field) => field.key == 'oAuthRedirectUrl').value;
|
||||
}
|
||||
|
||||
async createAuthLink() {
|
||||
async createAuthData() {
|
||||
const url = this.oauthClient.generateAuthUrl({
|
||||
access_type: 'offline',
|
||||
scope: this.scopes
|
||||
|
@@ -71,7 +71,7 @@
|
||||
{
|
||||
"step": 2,
|
||||
"type": "mutation",
|
||||
"name": "createAuthLink",
|
||||
"name": "createAuthData",
|
||||
"fields": [
|
||||
{
|
||||
"name": "id",
|
||||
@@ -86,7 +86,7 @@
|
||||
"fields": [
|
||||
{
|
||||
"name": "url",
|
||||
"value": "{createAuthLink.url}"
|
||||
"value": "{createAuthData.url}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -163,7 +163,7 @@
|
||||
{
|
||||
"step": 3,
|
||||
"type": "mutation",
|
||||
"name": "createAuthLink",
|
||||
"name": "createAuthData",
|
||||
"fields": [
|
||||
{
|
||||
"name": "id",
|
||||
@@ -178,7 +178,7 @@
|
||||
"fields": [
|
||||
{
|
||||
"name": "url",
|
||||
"value": "{createAuthLink.url}"
|
||||
"value": "{createAuthData.url}"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@@ -26,7 +26,7 @@ export default class Flickr {
|
||||
this.appData = App.findOneByKey('flickr');
|
||||
}
|
||||
|
||||
async createAuthLink() {
|
||||
async createAuthData() {
|
||||
const appFields = this.appData.fields.find((field: Field) => field.key == 'oAuthRedirectUrl')
|
||||
const callbackUrl = appFields.value;
|
||||
|
||||
|
@@ -71,7 +71,7 @@
|
||||
{
|
||||
"step": 2,
|
||||
"type": "mutation",
|
||||
"name": "createAuthLink",
|
||||
"name": "createAuthData",
|
||||
"fields": [
|
||||
{
|
||||
"name": "id",
|
||||
@@ -86,7 +86,7 @@
|
||||
"fields": [
|
||||
{
|
||||
"name": "url",
|
||||
"value": "{createAuthLink.url}"
|
||||
"value": "{createAuthData.url}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -163,7 +163,7 @@
|
||||
{
|
||||
"step": 3,
|
||||
"type": "mutation",
|
||||
"name": "createAuthLink",
|
||||
"name": "createAuthData",
|
||||
"fields": [
|
||||
{
|
||||
"name": "id",
|
||||
@@ -178,7 +178,7 @@
|
||||
"fields": [
|
||||
{
|
||||
"name": "url",
|
||||
"value": "{createAuthLink.url}"
|
||||
"value": "{createAuthData.url}"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@@ -36,7 +36,7 @@ export default class Twitch {
|
||||
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', {
|
||||
search: {
|
||||
client_id: this.connectionData.consumerKey,
|
||||
|
@@ -71,7 +71,7 @@
|
||||
{
|
||||
"step": 2,
|
||||
"type": "mutation",
|
||||
"name": "createAuthLink",
|
||||
"name": "createAuthData",
|
||||
"fields": [
|
||||
{
|
||||
"name": "id",
|
||||
@@ -86,7 +86,7 @@
|
||||
"fields": [
|
||||
{
|
||||
"name": "url",
|
||||
"value": "{createAuthLink.url}"
|
||||
"value": "{createAuthData.url}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -163,7 +163,7 @@
|
||||
{
|
||||
"step": 3,
|
||||
"type": "mutation",
|
||||
"name": "createAuthLink",
|
||||
"name": "createAuthData",
|
||||
"fields": [
|
||||
{
|
||||
"name": "id",
|
||||
@@ -178,7 +178,7 @@
|
||||
"fields": [
|
||||
{
|
||||
"name": "url",
|
||||
"value": "{createAuthLink.url}"
|
||||
"value": "{createAuthData.url}"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@@ -19,7 +19,7 @@ export default class Twitter {
|
||||
this.appData = App.findOneByKey('twitter');
|
||||
}
|
||||
|
||||
async createAuthLink() {
|
||||
async createAuthData() {
|
||||
const appFields = this.appData.fields.find((field: Field) => field.key == 'oAuthRedirectUrl')
|
||||
const callbackUrl = appFields.value;
|
||||
|
||||
|
@@ -71,7 +71,7 @@
|
||||
{
|
||||
"step": 2,
|
||||
"type": "mutation",
|
||||
"name": "createAuthLink",
|
||||
"name": "createAuthData",
|
||||
"fields": [
|
||||
{
|
||||
"name": "id",
|
||||
@@ -86,7 +86,7 @@
|
||||
"fields": [
|
||||
{
|
||||
"name": "url",
|
||||
"value": "{createAuthLink.url}"
|
||||
"value": "{createAuthData.url}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -163,7 +163,7 @@
|
||||
{
|
||||
"step": 3,
|
||||
"type": "mutation",
|
||||
"name": "createAuthLink",
|
||||
"name": "createAuthData",
|
||||
"fields": [
|
||||
{
|
||||
"name": "id",
|
||||
@@ -178,7 +178,7 @@
|
||||
"fields": [
|
||||
{
|
||||
"name": "url",
|
||||
"value": "{createAuthLink.url}"
|
||||
"value": "{createAuthData.url}"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@@ -6,7 +6,7 @@ import RequestWithCurrentUser from '../../types/express/request-with-current-use
|
||||
type Params = {
|
||||
id: number,
|
||||
}
|
||||
const createAuthLinkResolver = async (params: Params, req: RequestWithCurrentUser) => {
|
||||
const createAuthDataResolver = async (params: Params, req: RequestWithCurrentUser) => {
|
||||
const connection = await Connection.query().findOne({
|
||||
user_id: req.currentUser.id,
|
||||
id: params.id
|
||||
@@ -19,7 +19,7 @@ const createAuthLinkResolver = async (params: Params, req: RequestWithCurrentUse
|
||||
consumerSecret: connection.data.consumerSecret
|
||||
});
|
||||
|
||||
const authLink = await appInstance.createAuthLink();
|
||||
const authLink = await appInstance.createAuthData();
|
||||
|
||||
await connection.$query().patch({
|
||||
data: {
|
||||
@@ -31,12 +31,12 @@ const createAuthLinkResolver = async (params: Params, req: RequestWithCurrentUse
|
||||
return authLink;
|
||||
}
|
||||
|
||||
const createAuthLink = {
|
||||
const createAuthData = {
|
||||
type: authLinkType,
|
||||
args: {
|
||||
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;
|
@@ -1,6 +1,6 @@
|
||||
import { GraphQLObjectType } from 'graphql';
|
||||
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 resetConnection from './mutations/reset-connection';
|
||||
import verifyConnection from './mutations/verify-connection';
|
||||
@@ -10,7 +10,7 @@ const rootMutation = new GraphQLObjectType({
|
||||
name: 'Mutation',
|
||||
fields: {
|
||||
createConnection,
|
||||
createAuthLink,
|
||||
createAuthData,
|
||||
updateConnection,
|
||||
resetConnection,
|
||||
verifyConnection,
|
||||
|
9
packages/web/src/graphql/mutations/create-auth-data.ts
Normal file
9
packages/web/src/graphql/mutations/create-auth-data.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { gql } from '@apollo/client';
|
||||
|
||||
export const CREATE_AUTH_DATA = gql`
|
||||
mutation createAuthData($id: String!) {
|
||||
createAuthData(id: $id) {
|
||||
url
|
||||
}
|
||||
}
|
||||
`;
|
@@ -1,9 +0,0 @@
|
||||
import { gql } from '@apollo/client';
|
||||
|
||||
export const CREATE_AUTH_LINK = gql`
|
||||
mutation CreateAuthLink($id: String!) {
|
||||
createAuthLink(id: $id) {
|
||||
url
|
||||
}
|
||||
}
|
||||
`;
|
@@ -3,7 +3,7 @@ import { UPDATE_CONNECTION } from './update-connection';
|
||||
import { VERIFY_CONNECTION } from './verify-connection';
|
||||
import { RESET_CONNECTION } from './reset-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 = {
|
||||
[key: string]: any,
|
||||
@@ -15,7 +15,7 @@ const mutations: Mutations = {
|
||||
verifyConnection: VERIFY_CONNECTION,
|
||||
resetConnection: RESET_CONNECTION,
|
||||
deleteConnection: DELETE_CONNECTION,
|
||||
createAuthLink: CREATE_AUTH_LINK,
|
||||
createAuthData: CREATE_AUTH_DATA,
|
||||
};
|
||||
|
||||
export default mutations;
|
||||
|
Reference in New Issue
Block a user