From 26a1785b3fb1ad05fd6c368208c8e8d865d7ff74 Mon Sep 17 00:00:00 2001 From: kaioken Date: Mon, 6 Jan 2025 08:39:48 -0400 Subject: [PATCH] feat: linked user devices --- package.json | 2 +- src/modules/users/index.ts | 2 +- test/user.test.ts | 20 ++++++++++++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index adae395..649861b 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "0.24.2", + "version": "0.24.3", "license": "MIT", "main": "dist/index.js", "typings": "dist/index.d.ts", diff --git a/src/modules/users/index.ts b/src/modules/users/index.ts index c868081..4da46f1 100644 --- a/src/modules/users/index.ts +++ b/src/modules/users/index.ts @@ -69,7 +69,7 @@ export class Users { public async getUserData(withSocial: boolean = false): Promise { const response = await this.client.query({ query: !withSocial ? GET_USER_DATA_QUERY : GET_USER_SOCIAL_DATA_QUERY, - fetchPolicy: 'network-only', + fetchPolicy: 'no-cache', }); return response.data.me; diff --git a/test/user.test.ts b/test/user.test.ts index 156a208..0fb2048 100644 --- a/test/user.test.ts +++ b/test/user.test.ts @@ -82,6 +82,26 @@ describe('Test the KanvasCore client', () => { expect(updateUser.firstname).toBe('Max'); }); + it('update custom field', async () => { + const client = getClient(); + const userInfo = await client.users.getUserData(); + const updatedUserInfo: UpdateUserParams = { + firstname: userInfo.firstname, + lastname: userInfo.lastname, + phone_number: userInfo.contact.phone_number, + cell_phone_number: userInfo.contact.cell_phone_number, + custom_fields: [{ name: 'test_custom_fields', data: '0', public: true }] + }; + + const updateUser = await client.users.updateUserData( + userInfo.id, + updatedUserInfo + ); + console.log(updateUser.custom_fields); + expect(updateUser).toBeDefined(); + expect(updateUser.firstname).toBe('Max'); + }); + it('gets user total following', async () => { const client = getClient(); const userInfo = await client.users.getUserData(true);