endpoints WIP

This commit is contained in:
Yulia Shanyrova 2022-06-06 17:00:32 +02:00
parent 848a1d066c
commit 5bd16f051b
3 changed files with 25 additions and 2 deletions

View file

@ -56,4 +56,22 @@ export class CloudStore extends BaseStore {
this.searchResult.results.map((cloud_user_id: Cloud['id']) => this.items?.[cloud_user_id]),
};
}
async syncCloudUsers() {
return await makeRequest(`${this.path}sync_with_cloud`, { method: 'POST' });
}
async getCloudConnectionStatus() {
return await makeRequest(`/cloud_connection/`, { method: 'GET' });
}
@action
async connectToCloud(token: string) {
return await makeRequest(`/live_settings/`, { method: 'PUT', params: { token } });
}
@action
async disconnectToCloud() {
return await makeRequest(`/live_settings/`, { method: 'DELETE' });
}
}

View file

@ -19,6 +19,10 @@
width: 100%;
}
.cloud-page-title {
margin-top: 24px;
}
.cloud-oncall-name {
color: #f55f3e;
}

View file

@ -50,12 +50,13 @@ const CloudPage = (props: CloudPageProps) => {
const disconnectCloudOncall = () => {
console.log('disconnected');
setCloudIsConnected(false);
store.cloudStore.disconnectToCloud();
};
const connectToCloud = () => {
console.log('CONNECT TO CLOUD');
setCloudIsConnected(true);
setShowConfirmationModal(false);
store.cloudStore.connectToCloud(cloudApiKey);
};
const syncUsers = () => {
@ -146,7 +147,7 @@ const CloudPage = (props: CloudPageProps) => {
return (
<div className={cx('root')}>
<VerticalGroup spacing="lg">
<Text.Title level={3}>
<Text.Title level={3} className={cx('cloud-page-title')}>
Connect Open Source OnCall and <Text className={cx('cloud-oncall-name')}>Cloud OnCall</Text>
</Text.Title>
<Block withBackground bordered className={cx('info-block')}>