Better handling of user fork

This commit is contained in:
NAmorim committed 2021-11-26 01:09:32 +00:00
1 parent 480d4121da
commit f318bcdf15
3 files changed
+14 -63

No files matched your search

+1 -4
View File
@@ -163,17 +163,14 @@ exports.newGithubServer = function newGithubServer() {
}
}
async function createGithubFork(repository, username, token) {
async function createGithubFork(token) {
try {
username = unescape(username)
token = unescape(token)
await doGithub()
async function doGithub() {
try {
//const repo = 'Superalgos'
//const owner = username
const { Octokit } = SA.nodeModules.octokit
const octokit = new Octokit({
auth: token,
+13 -2
View File
@@ -1315,8 +1315,6 @@ exports.newHttpInterface = function newHttpInterface() {
case 'createGithubFork': {
let serverResponse = await PL.servers.GITHUB_SERVER.createGithubFork(
params.repository,
params.username,
params.token
)
@@ -1355,8 +1353,21 @@ exports.newHttpInterface = function newHttpInterface() {
let error
await checkFork()
await updateUser()
async function checkFork() {
let serverResponse = await PL.servers.GITHUB_SERVER.createGithubFork(
params.token
)
SA.projects.foundations.utilities.httpResponses.respondWithContent(JSON.stringify(serverResponse), httpResponse)
if(error != undefined) {
console.log('[ERROR] httpInterface -> Gov -> createFork -> You already have a fork. Good for you!')
}
}
async function updateUser() {
await doGithubUser()