From 5a8bd8493f4735d7b5702cfdd2e0862ae8b627c9 Mon Sep 17 00:00:00 2001 From: Yulia Shanyrova Date: Wed, 8 Jun 2022 15:07:49 +0200 Subject: [PATCH] endpoint for cloud user --- .../parts/tabs/CloudPhoneSettings/CloudPhoneSettings.tsx | 7 +------ grafana-plugin/src/models/cloud/cloud.ts | 6 +++++- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/grafana-plugin/src/containers/UserSettings/parts/tabs/CloudPhoneSettings/CloudPhoneSettings.tsx b/grafana-plugin/src/containers/UserSettings/parts/tabs/CloudPhoneSettings/CloudPhoneSettings.tsx index a5ea00f1..07544bea 100644 --- a/grafana-plugin/src/containers/UserSettings/parts/tabs/CloudPhoneSettings/CloudPhoneSettings.tsx +++ b/grafana-plugin/src/containers/UserSettings/parts/tabs/CloudPhoneSettings/CloudPhoneSettings.tsx @@ -52,12 +52,7 @@ const CloudPhoneSettings = observer((props: CloudPhoneSettingsProps) => { }; const getCloudUserInfo = async () => { - await store.cloudStore.updateItems(); - const { count, results } = await store.cloudStore.getSearchResult(); - console.log('RES', results); - const cloudUser = - results && (await results.find((element: { id: string }) => element.id === store.userStore.currentUserPk)); - console.log('CLOUD USER', cloudUser); + const cloudUser = await store.cloudStore.getCloudUser(store.userStore.currentUserPk); setUserStatus(cloudUser?.cloud_data?.status); setUserLink(cloudUser?.cloud_data?.link); }; diff --git a/grafana-plugin/src/models/cloud/cloud.ts b/grafana-plugin/src/models/cloud/cloud.ts index f1dd54f2..f93c1d46 100644 --- a/grafana-plugin/src/models/cloud/cloud.ts +++ b/grafana-plugin/src/models/cloud/cloud.ts @@ -59,7 +59,11 @@ export class CloudStore extends BaseStore { } async syncCloudUser(id: string) { - return await makeRequest(`${this.path}${id}/sync/`, { method: 'POST' }); + return await makeRequest(`${this.path}`, { method: 'POST' }); + } + + async getCloudUser(id: string) { + return await makeRequest(`${this.path}${id}`, { method: 'GET' }); } async getCloudConnectionStatus() {