Skip to content

Commit 3d6bdc0

Browse files
committed
diconnect socket in logout
1 parent 395d901 commit 3d6bdc0

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "helyosjs-sdk",
3-
"version": "2.0.3",
3+
"version": "2.0.4",
44
"description": "Comunication with helyos postgress database using graphql interface",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

src/cruds/assignments.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ApolloClient } from "apollo-client";
22
import gql from "graphql-tag";
33

4-
import { gqlJsonResponseHandler, gqlJsonResponseInstanceHandler, parseStringifiedJsonColumns, stringifyJsonFields } from "../helyos.helpers";
4+
import { gqlJsonResponseHandler, parseStringifiedJsonColumns, stringifyJsonFields } from "../helyos.helpers";
55
import { H_Assignment } from '../helyos.models';
66

77

@@ -64,7 +64,7 @@ import { H_Assignment } from '../helyos.models';
6464

6565

6666
createMany(assignments: Partial<H_Assignment>[]): Promise<any> {
67-
const promise_list = assignments.map(s => this.create(s).then(r=>r[0])); // 30.09.2020: I don't remember why I am returning an one-element array in create(). Carlos
67+
const promise_list = assignments.map(s => this.create(s).then(r=>r[0]));
6868
return Promise.all(promise_list);
6969
}
7070

@@ -99,12 +99,12 @@ import { H_Assignment } from '../helyos.models';
9999
delete postData.id;
100100
delete postData['__typename'];
101101

102-
stringifyJsonFields(postData, ['data', 'context']);
102+
stringifyJsonFields(postData, ['data', 'context', 'result']);
103103

104104
const postMessage = { clientMutationId: "not_used", assignment: postData };
105105
return this._client.mutate({ mutation: SHAPE_CREATE, variables: { postMessage, assignment: postData } })
106106
.then(response => {
107-
return [response.data[QUERY_FUNTCION].assignment]; // 30.09.2020: I don't remember why I am returning an one-element array here. Carlos
107+
return response.data[QUERY_FUNTCION].assignment;
108108
})
109109
.catch(e => console.log("postAssignment called by" + this.create.caller, e))
110110
}
@@ -175,7 +175,7 @@ import { H_Assignment } from '../helyos.models';
175175

176176
const patch = {...assignment};
177177
delete patch['__typename'];
178-
stringifyJsonFields(patch, [ 'data', 'context']);
178+
stringifyJsonFields(patch, [ 'data', 'context', 'result']);
179179

180180
const postMessage = { id: assignment.id, assignmentPatch: patch };
181181

src/cruds/external_services.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ import { H_Service } from '../helyos.models';
9393
`;
9494

9595
const postMessage = { clientMutationId: "not_used", service: service };
96-
console.log("postMessage",postMessage)
9796
return this._client.mutate({ mutation: CREATE, variables: { postMessage, service: service } })
9897
.then(response => {
9998
return gqlJsonResponseInstanceHandler(response, QUERY_FUNTCION,'service' );

src/helyos.helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export const parseStringifiedJsonColumns = (list: any[], columnNames: string[] )
4040
const _list = [...list];
4141
_list.forEach(obj => {
4242
columnNames.forEach(name => {
43-
if (obj[name] && !isObject(obj[name])) {
43+
if (obj && obj[name] && !isObject(obj[name])) {
4444
try {
4545
obj[name] = JSON.parse(obj[name]);
4646
} catch (error) {

src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,8 @@ export class HelyosServices {
294294
if (response.data[QUERY_FUNTCION].jwtToken) {
295295
this.token = null;
296296
}
297-
return{msg:'token invalidated'};
297+
this.socket.disconnect();
298+
return{msg:'auth token invalidated and socket disconnected.'};
298299
})
299300
.catch(e => {
300301
console.log(e);

0 commit comments

Comments
 (0)