Skip to content

Commit 395d901

Browse files
committed
get methods returns null when instance is not found
1 parent e2545dc commit 395d901

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
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.2",
3+
"version": "2.0.3",
44
"description": "Comunication with helyos postgress database using graphql interface",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

src/cruds/mission_queue.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ import { H_MissionQueue } from '../helyos.models';
124124
const postMessage = { id: wprocess.id, missionQueuePatch: patch };
125125
return this._client.mutate({ mutation: UPDATE, variables: { postMessage } })
126126
.then(response => {
127-
console.log('create request', response);
128127
return response;
129128
})
130129
.catch(e => {
@@ -135,8 +134,6 @@ import { H_MissionQueue } from '../helyos.models';
135134

136135

137136
get(missionQueueId: string ): Promise<any> {
138-
console.log("id", missionQueueId)
139-
140137
const QUERY_FUNTCION = 'missionQueueById';
141138
const QUERY_STR = gql`
142139
query ${QUERY_FUNTCION}($missionQueueId: BigInt! ){

src/helyos.helpers.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ const isObject = (value) => (typeof value === 'object');
55
const isString = (value) => (typeof value === 'string' || value instanceof String)
66

77
export const gqlJsonResponseHandler = (res: any, queryName: string) => {
8+
if (!res.data[queryName]) {
9+
return null;
10+
}
11+
812
if (res.data[queryName].edges) {
913
return res.data[queryName].edges.map((gqlElement: any) => gqlElement.node);
1014
} else {

0 commit comments

Comments
 (0)