refactor: Use generateAuthUrl method instead of createAuthData

This commit is contained in:
Faruk AYDIN
2022-11-10 18:50:36 +01:00
parent 10e2794ff9
commit 81c41ef5ee
21 changed files with 42 additions and 50 deletions

View File

@@ -2,7 +2,7 @@ import Context from '../../types/express/context';
import axios from 'axios';
import globalVariable from '../../helpers/global-variable';
import App from '../../models/app';
import CreateAuthDataError from '../../errors/create-auth-data';
import GenerateAuthUrlError from '../../errors/generate-auth-url';
type Params = {
input: {
@@ -10,7 +10,7 @@ type Params = {
};
};
const createAuthData = async (
const generateAuthUrl = async (
_parent: unknown,
params: Params,
context: Context
@@ -32,13 +32,13 @@ const createAuthData = async (
const $ = await globalVariable({ connection, app });
try {
await authInstance.createAuthData($);
await authInstance.generateAuthUrl($);
await axios.get(connection.formattedData.url as string);
} catch (error) {
throw new CreateAuthDataError(error);
throw new GenerateAuthUrlError(error);
}
return connection.formattedData;
};
export default createAuthData;
export default generateAuthUrl;