diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/SocketStub.ts | 1 | ||||
-rw-r--r-- | src/client/views/Main.tsx | 6 | ||||
-rw-r--r-- | src/server/database.ts | 8 | ||||
-rw-r--r-- | src/server/index.ts | 6 |
4 files changed, 6 insertions, 15 deletions
diff --git a/src/client/SocketStub.ts b/src/client/SocketStub.ts index c48f21f63..18df4ca0a 100644 --- a/src/client/SocketStub.ts +++ b/src/client/SocketStub.ts @@ -48,7 +48,6 @@ export class SocketStub { public static SEND_FIELDS_REQUEST(fieldIds: FieldId[], callback: (fields: { [key: string]: Field }) => any) { Utils.EmitCallback(Server.Socket, MessageStore.GetFields, fieldIds, (fields: any[]) => { - console.log(fieldIds); let fieldMap: any = {}; for (let field of fields) { fieldMap[field._id] = ServerUtils.FromJson(field); diff --git a/src/client/views/Main.tsx b/src/client/views/Main.tsx index 4a0f2b021..5ff16b8dc 100644 --- a/src/client/views/Main.tsx +++ b/src/client/views/Main.tsx @@ -23,7 +23,6 @@ import { observer } from 'mobx-react'; import { Field, Opt } from '../../fields/Field'; import { InkingControl } from './InkingControl'; import { RouteStore } from '../../server/RouteStore'; -import { Database } from '../../server/database'; @observer export class Main extends React.Component { @@ -31,7 +30,6 @@ export class Main extends React.Component { @observable private mainContainer?: Document; @observable private mainfreeform?: Document; @observable private userWorkspaces: Document[] = []; - @observable private activeUsers: Document[] = []; constructor(props: Readonly<{}>) { super(props); @@ -91,7 +89,6 @@ export class Main extends React.Component { this.openWorkspace(mainDoc); }, 0); this.userWorkspaces.push(mainDoc); - mainDoc.GetList<Document>(KeyStore.ActiveUsers, []); } @action @@ -131,6 +128,7 @@ export class Main extends React.Component { let audioRef = React.createRef<HTMLDivElement>(); let colRef = React.createRef<HTMLDivElement>(); let workspacesRef = React.createRef<HTMLDivElement>(); + let logoutRef = React.createRef<HTMLDivElement>(); let imgurl = "https://upload.wikimedia.org/wikipedia/commons/thumb/3/3a/Cat03.jpg/1200px-Cat03.jpg"; let pdfurl = "http://www.adobe.com/support/products/enterprise/knowledgecenter/media/c4611_sample_explain.pdf" @@ -181,6 +179,8 @@ export class Main extends React.Component { <button onClick={clearDatabase}>Clear Database</button></div> <div className="main-buttonDiv" style={{ top: '25px' }} ref={workspacesRef}> <button onClick={this.toggleWorkspaces}>View Workspaces</button></div> + <div className="main-buttonDiv" style={{ top: '25px', left: '300px' }} ref={logoutRef}> + <button onClick={() => request.get(this.prepend(RouteStore.logout), () => { })}>Log Out</button></div> <div className="main-buttonDiv" style={{ bottom: '175px' }} ref={videoRef}> <button onPointerDown={setupDrag(videoRef, addVideoNode)} onClick={addClick(addVideoNode)}>Add Video</button></div> <div className="main-buttonDiv" style={{ bottom: '200px' }} ref={audioRef}> diff --git a/src/server/database.ts b/src/server/database.ts index f414266e2..164bdd68a 100644 --- a/src/server/database.ts +++ b/src/server/database.ts @@ -19,7 +19,7 @@ export class Database { public update(id: string, value: any, callback: () => void) { if (this.db) { let collection = this.db.collection('documents'); - collection.update({ _id: id }, { $set: value }, { + collection.updateOne({ _id: id }, { $set: value }, { upsert: true }, callback); } @@ -71,15 +71,9 @@ export class Database { let cursor = collection.find({ _id: { "$in": ids } }) cursor.toArray((err, docs) => { if (err) { - console.log("Error"); console.log(err.message); console.log(err.errmsg); - console.log(ids); - console.log(["afca93a8-c6bd-4b58-967e-07784c5b12c8"]); - console.log("MAKES SENSE: " + (ids instanceof Array)); } - console.log(typeof ids); - console.log("DATABASE: " + docs); fn(docs); }) }; diff --git a/src/server/index.ts b/src/server/index.ts index 6f6f620d8..d710ac875 100644 --- a/src/server/index.ts +++ b/src/server/index.ts @@ -139,9 +139,7 @@ addSecureRoute(Method.POST, RouteStore.upload, (user, req, res) => { // anyone attempting to navigate to localhost at this port will // first have to login addSecureRoute(Method.GET, RouteStore.root, (user, req, res) => { - -}, res => { - res.send() + res.redirect(RouteStore.home); }); // YAY! SHOW THEM THEIR WORKSPACES NOW @@ -154,7 +152,7 @@ addSecureRoute(Method.GET, RouteStore.getActiveWorkspace, (user, req, res) => { }); addSecureRoute(Method.GET, RouteStore.getAllWorkspaces, (user, req, res) => { - res.send(JSON.stringify(user.allWorkspaceIds as Array<String>)); + res.send(JSON.stringify(user.allWorkspaceIds)); }); addSecureRoute(Method.POST, RouteStore.setActiveWorkspace, (user, req) => { |