mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Converting server-side Comm.js to typescript
Summary: - Add app/common/CommTypes.ts to define types shared by client and server. - Include @types/ws npm package Test Plan: Intended to have no changes in behavior Reviewers: paulfitz Reviewed By: paulfitz Differential Revision: https://phab.getgrist.com/D3467
This commit is contained in:
@@ -143,7 +143,7 @@ export async function openClient(server: FlexServer, email: string, org: string,
|
||||
if (email !== 'anon@getgrist.com') {
|
||||
const cid = decodeURIComponent(cookie.split('=')[1].split(';')[0]);
|
||||
const comm = server.getComm();
|
||||
const sessionId = comm.getSessionIdFromCookie(cid);
|
||||
const sessionId = comm.getSessionIdFromCookie(cid)!;
|
||||
const scopedSession = comm.getOrCreateSession(sessionId, {org});
|
||||
const profile = { email, email_verified: true, name: "Someone" };
|
||||
await scopedSession.updateUserProfile({} as any, profile);
|
||||
@@ -155,6 +155,7 @@ export async function openClient(server: FlexServer, email: string, org: string,
|
||||
const ws = new WebSocket('ws://localhost:' + server.getOwnPort() + `/o/${org}`, {
|
||||
headers
|
||||
});
|
||||
const client = new GristClient(ws);
|
||||
await new Promise(function(resolve, reject) {
|
||||
ws.on('open', function() {
|
||||
resolve(ws);
|
||||
@@ -163,5 +164,5 @@ export async function openClient(server: FlexServer, email: string, org: string,
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
return new GristClient(ws);
|
||||
return client;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user