From 3daca894b6eaf1eb8590f54b1a5bf5feca663a08 Mon Sep 17 00:00:00 2001 From: yipstanley Date: Fri, 12 Jul 2019 22:34:09 -0400 Subject: links now go between users --- src/client/views/Main.tsx | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/client/views/Main.tsx') diff --git a/src/client/views/Main.tsx b/src/client/views/Main.tsx index 932a6375f..1b9a45f0b 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(); + 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(links); + } + } + CurrentUserUtils.UserDocument.LinkManagerDoc = undefined; + } +} (async () => { await Docs.Prototypes.initialize(); await CurrentUserUtils.loadCurrentUser(); + await swapDocs(); ReactDOM.render(, document.getElementById('root')); })(); \ No newline at end of file -- cgit v1.2.3-70-g09d2 From 3c6c4e6da942ef4c1e7faebdc165eb4fcaa7bee4 Mon Sep 17 00:00:00 2001 From: yipstanley Date: Sat, 13 Jul 2019 16:34:42 -0400 Subject: oops --- src/client/views/Main.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/client/views/Main.tsx') diff --git a/src/client/views/Main.tsx b/src/client/views/Main.tsx index 1b9a45f0b..971658473 100644 --- a/src/client/views/Main.tsx +++ b/src/client/views/Main.tsx @@ -9,7 +9,7 @@ import { List } from "../../new_fields/List"; let swapDocs = async () => { let oldDoc = await Cast(CurrentUserUtils.UserDocument.linkManagerDoc, Doc); - Docs.Prototypes.MainLinkDocument().allLinks = new List(); + // Docs.Prototypes.MainLinkDocument().allLinks = new List(); if (oldDoc) { let links = await DocListCastAsync(oldDoc.allLinks); // if (links && DocListCast(links)) { -- cgit v1.2.3-70-g09d2