Skip to content

Commit 9bae370

Browse files
Merge pull request #443 from Workgrid/firstname
ETSWORK-17838 Get current user name via me query
2 parents ecd3e71 + 720b7da commit 9bae370

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

packages/workgrid-client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@workgrid/client",
3-
"version": "0.1.1",
3+
"version": "0.1.2",
44
"main": "dist/client.js",
55
"types": "dist/client.d.ts",
66
"files": [

packages/workgrid-client/src/client.test.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,20 @@ const server = setupServer(
121121
return res(ctx.json({ data: { id: req.params.id, title: `${req.method} ${req.url.pathname}` } }))
122122
}),
123123
rest.post(`https://company-code.workgrid.com/v1/graphql`, (req, res, ctx) => {
124-
return res(ctx.json({ data: { currentUser: { id: '123124', displayName: 'displayName' } } }))
124+
return res(
125+
ctx.json({
126+
data: {
127+
currentUser: {
128+
id: '123124',
129+
displayName: 'displayName',
130+
name: {
131+
familyName: 'test',
132+
givenName: 'testName',
133+
},
134+
},
135+
},
136+
})
137+
)
125138
}),
126139
rest.post(`https://company-code.workgrid.com/v2/ask`, (req, res, ctx) => {
127140
return res(
@@ -325,6 +338,10 @@ describe('@workgrid/client', () => {
325338
Object {
326339
"displayName": "displayName",
327340
"id": "123124",
341+
"name": Object {
342+
"familyName": "test",
343+
"givenName": "testName",
344+
},
328345
}
329346
`)
330347
})

packages/workgrid-client/src/client.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,10 @@ setTypedQueryDefaults('me', (client) => ({
363363
currentUser(authContext: $authContext) {
364364
id
365365
displayName
366+
name {
367+
givenName
368+
familyName
369+
}
366370
}
367371
}
368372
`,

0 commit comments

Comments
 (0)