diff options
author | Tyler Schicke <tyler_schicke@brown.edu> | 2019-07-13 16:46:58 -0400 |
---|---|---|
committer | Tyler Schicke <tyler_schicke@brown.edu> | 2019-07-13 16:46:58 -0400 |
commit | 2e75ca29e6e17d637cdad5992ee55e921559922a (patch) | |
tree | 6a471f0a7c20c3fc6695e22cf38388458ec22972 /src/client/views/Main.tsx | |
parent | 60ceef0a3a8c11d85434a154e542424d34d9562c (diff) | |
parent | 3c6c4e6da942ef4c1e7faebdc165eb4fcaa7bee4 (diff) |
Merge branch 'master' of github-tsch-brown:browngraphicslab/Dash-Web
Diffstat (limited to 'src/client/views/Main.tsx')
-rw-r--r-- | src/client/views/Main.tsx | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/client/views/Main.tsx b/src/client/views/Main.tsx index 932a6375f..971658473 100644 --- a/src/client/views/Main.tsx +++ b/src/client/views/Main.tsx @@ -3,9 +3,32 @@ import { Docs } from "../documents/Documents"; import { CurrentUserUtils } from "../../server/authentication/models/current_user_utils"; import * as ReactDOM from 'react-dom'; import * as React from 'react'; +import { Cast } from "../../new_fields/Types"; +import { Doc, DocListCastAsync } from "../../new_fields/Doc"; +import { List } from "../../new_fields/List"; + +let swapDocs = async () => { + let oldDoc = await Cast(CurrentUserUtils.UserDocument.linkManagerDoc, Doc); + // Docs.Prototypes.MainLinkDocument().allLinks = new List<Doc>(); + if (oldDoc) { + let links = await DocListCastAsync(oldDoc.allLinks); + // if (links && DocListCast(links)) { + if (links && links.length) { + let data = await DocListCastAsync(Docs.Prototypes.MainLinkDocument().allLinks); + if (data) { + data.push(...links); + } + else { + Docs.Prototypes.MainLinkDocument().allLinks = new List<Doc>(links); + } + } + CurrentUserUtils.UserDocument.LinkManagerDoc = undefined; + } +} (async () => { await Docs.Prototypes.initialize(); await CurrentUserUtils.loadCurrentUser(); + await swapDocs(); ReactDOM.render(<MainView />, document.getElementById('root')); })();
\ No newline at end of file |