mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2026-05-17 08:47:50 +00:00
Send feedback metadata to JaaS feedback endpoint
This commit is contained in:
committed by
Horatiu Muresan
parent
01a127b557
commit
aea09a8da3
50
react/features/feedback/functions.js
Normal file
50
react/features/feedback/functions.js
Normal file
@@ -0,0 +1,50 @@
|
||||
// @flow
|
||||
|
||||
import logger from './logger';
|
||||
|
||||
/**
|
||||
* Sends feedback metadata to JaaS endpoints.
|
||||
*
|
||||
* @param {string} url - The JaaS metadata endpoint URL.
|
||||
* @param {Object} feedbackData - The feedback data object.
|
||||
* @returns {Promise}
|
||||
*/
|
||||
export async function sendFeedbackToJaaSRequest(url: string, feedbackData: Object) {
|
||||
const {
|
||||
jwt,
|
||||
sessionId,
|
||||
meetingFqn,
|
||||
score,
|
||||
message,
|
||||
userId,
|
||||
tenant
|
||||
} = feedbackData;
|
||||
const headers = {
|
||||
'Authorization': `Bearer ${jwt}`,
|
||||
'Content-Type': 'application/json'
|
||||
};
|
||||
const data = {
|
||||
sessionId,
|
||||
meetingFqn,
|
||||
userId,
|
||||
tenant,
|
||||
submitted: new Date().getTime(),
|
||||
rating: score,
|
||||
comments: message
|
||||
};
|
||||
|
||||
try {
|
||||
const res = await fetch(url, {
|
||||
method: 'POST',
|
||||
headers,
|
||||
body: JSON.stringify(data)
|
||||
});
|
||||
|
||||
if (!res.ok) {
|
||||
logger.error('Status error:', res.status);
|
||||
}
|
||||
} catch (err) {
|
||||
logger.error('Could not send request', err);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user