diff --git a/assets/scripts/actions/setup.js b/assets/scripts/actions/setup.js index cd3aa49..1a0fb0b 100644 --- a/assets/scripts/actions/setup.js +++ b/assets/scripts/actions/setup.js @@ -154,13 +154,11 @@ export const createRepositoryForCurrentAccount = async (repoName, template) => { return ( getOAuthServiceAPI() .createDefaultRepository(scribouilliGitRepo, template) - .then(({repoId, cloneUrl}) => { - console.log('cloneUrl', cloneUrl) - console.log('cloneUrl || `${origin}/${repoId}.git`', cloneUrl || `${origin}/${repoId}.git`) + .then(({remoteURL}) => { const gitAgent = new GitAgent({ - repoId: repoId || makeRepoId(owner, escapedRepoName), - remoteURL: cloneUrl || `${origin}/${repoId}.git`, + repoId: makeRepoId(owner, escapedRepoName), + remoteURL: remoteURL, onMergeConflict : (/** @type {import("./../store.js").ResolutionOption[] | undefined} */ resolutionOptions) => { store.mutations.setConflict(resolutionOptions) }, diff --git a/assets/scripts/oauth-services-api/github.js b/assets/scripts/oauth-services-api/github.js index b6015bb..7b97346 100644 --- a/assets/scripts/oauth-services-api/github.js +++ b/assets/scripts/oauth-services-api/github.js @@ -71,7 +71,7 @@ export default class GitHubAPI { }, ) .then(r => r.json()) - .then(({url: newRepoAPIURL, clone_url: cloneUrl, full_name: repoId}) => { + .then(({url: newRepoAPIURL, clone_url}) => { // Activate GitHub Pages return this.callAPI(`${newRepoAPIURL}/pages`, { method: 'POST', @@ -116,7 +116,7 @@ export default class GitHubAPI { }) }) }) - .then(() => { return {repoId, cloneUrl} }) + .then(() => ({remoteURL: clone_url})) }) } diff --git a/assets/scripts/oauth-services-api/gitlab.js b/assets/scripts/oauth-services-api/gitlab.js index 42a64f3..28f2e1a 100644 --- a/assets/scripts/oauth-services-api/gitlab.js +++ b/assets/scripts/oauth-services-api/gitlab.js @@ -117,7 +117,9 @@ export default class GitLabAPI { topics: ['site-scribouilli'], visibility: 'public', }), - }).then(response => response.json()) + }) + .then(response => response.json()) + .then(({http_url_to_repo}) => ({remoteURL: http_url_to_repo})) } /** @type {OAuthServiceAPI["deploy"]} */ diff --git a/assets/scripts/types.js b/assets/scripts/types.js index d09415b..052ff88 100644 --- a/assets/scripts/types.js +++ b/assets/scripts/types.js @@ -38,7 +38,7 @@ * @property {() => {username: string, password: string}} getOauthUsernameAndPassword * @property {() => Promise} getAuthenticatedUser * @property {() => Promise} getUserEmails - * @property {(scribouilliGitRepo: ScribouilliGitRepo, template: GitSiteTemplate) => Promise} createDefaultRepository + * @property {(scribouilliGitRepo: ScribouilliGitRepo, template: GitSiteTemplate) => Promise<{remoteURL: string}>} createDefaultRepository * @property {(scribouilliGitRepo: ScribouilliGitRepo) => Promise} isRepositoryReady * @property {() => Promise} getCurrentUserRepositories * @property {(scribouilliGitRepo: ScribouilliGitRepo) => Promise} deploy