Fix connect to github (#951)

This commit is contained in:
victor-meng 2021-07-21 17:47:55 -07:00 committed by GitHub
parent c5e4ee9c2b
commit 401660ae15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -153,35 +153,31 @@ export const useNotebook: UseStore<NotebookState> = create((set, get) => ({
set({ myNotebooksContentRoot: root });
},
initializeNotebooksTree: async (notebookManager: NotebookManager): Promise<void> => {
set({
myNotebooksContentRoot: {
name: "My Notebooks",
path: get().notebookBasePath,
type: NotebookContentItemType.Directory,
},
galleryContentRoot: {
name: "Gallery",
path: "Gallery",
type: NotebookContentItemType.File,
},
});
if (notebookManager?.gitHubOAuthService?.isLoggedIn()) {
set({
gitHubNotebooksContentRoot: {
const myNotebooksContentRoot = {
name: "My Notebooks",
path: get().notebookBasePath,
type: NotebookContentItemType.Directory,
};
const galleryContentRoot = {
name: "Gallery",
path: "Gallery",
type: NotebookContentItemType.File,
};
const gitHubNotebooksContentRoot = notebookManager?.gitHubOAuthService?.isLoggedIn()
? {
name: "GitHub repos",
path: "PsuedoDir",
type: NotebookContentItemType.Directory,
},
});
}
}
: undefined;
set({
myNotebooksContentRoot,
galleryContentRoot,
gitHubNotebooksContentRoot,
});
if (get().notebookServerInfo?.notebookServerEndpoint) {
const updatedRoot = await notebookManager?.notebookContentClient?.updateItemChildren({
name: "My Notebooks",
path: get().notebookBasePath,
type: NotebookContentItemType.Directory,
});
const updatedRoot = await notebookManager?.notebookContentClient?.updateItemChildren(myNotebooksContentRoot);
set({ myNotebooksContentRoot: updatedRoot });
if (updatedRoot?.children) {