made types optional and, workbench get repo fix
This commit is contained in:
@@ -11,7 +11,7 @@ import { PreviewsStore } from './previews';
|
||||
import { TerminalStore } from './terminal';
|
||||
import JSZip from 'jszip';
|
||||
import { saveAs } from 'file-saver';
|
||||
import { Octokit } from "@octokit/rest";
|
||||
import { Octokit, type RestEndpointMethodTypes } from "@octokit/rest";
|
||||
import * as nodePath from 'node:path';
|
||||
import type { WebContainerProcess } from '@webcontainer/api';
|
||||
|
||||
@@ -382,9 +382,10 @@ export class WorkbenchStore {
|
||||
const octokit = new Octokit({ auth: githubToken });
|
||||
|
||||
// Check if the repository already exists before creating it
|
||||
let repo
|
||||
let repo: RestEndpointMethodTypes["repos"]["get"]["response"]['data']
|
||||
try {
|
||||
repo = await octokit.repos.get({ owner: owner, repo: repoName });
|
||||
let resp = await octokit.repos.get({ owner: owner, repo: repoName });
|
||||
repo = resp.data
|
||||
} catch (error) {
|
||||
if (error instanceof Error && 'status' in error && error.status === 404) {
|
||||
// Repository doesn't exist, so create a new one
|
||||
|
||||
Reference in New Issue
Block a user