The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/apps/meteor/app/cloud/server/functions/getConfirmationPoll.ts

30 lines
974 B

import type { CloudConfirmationPollData } from '@rocket.chat/core-typings';
import { serverFetch as fetch } from '@rocket.chat/server-fetch';
import { SystemLogger } from '../../../../server/lib/logger/system';
import { settings } from '../../../settings/server';
export async function getConfirmationPoll(deviceCode: string): Promise<CloudConfirmationPollData> {
try {
const cloudUrl = settings.get<string>('Cloud_Url');
const response = await fetch(`${cloudUrl}/api/v2/register/workspace/poll`, { params: { token: deviceCode } });
try {
if (!response.ok) {
throw new Error((await response.json()).error);
}
return await response.json();
} catch (err) {
throw new Error(`Failed to retrieve registration confirmation poll data: ${response.statusText}`);
}
} catch (err: any) {
SystemLogger.error({
msg: 'Failed to get confirmation poll from Rocket.Chat Cloud',
url: '/api/v2/register/workspace/poll',
err,
});
throw err;
}
}