endpoint for cloud user

This commit is contained in:
Yulia Shanyrova 2022-06-08 15:07:49 +02:00
parent ef92ec8aea
commit 5a8bd8493f
2 changed files with 6 additions and 7 deletions

View file

@ -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);
};

View file

@ -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() {