frontend: update changeParticipantRole to use putRequest
This commit is contained in:
parent
8ccf3d9f8e
commit
e572f9feb5
@ -28,6 +28,11 @@ export class HttpService {
|
|||||||
return lastValueFrom(this.http.put<T>(path, body, options));
|
return lastValueFrom(this.http.put<T>(path, body, options));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async patchRequest<T>(path: string, body: any = {}, headers?: Record<string, string>): Promise<T> {
|
||||||
|
const options = headers ? { headers: new HttpHeaders(headers) } : {};
|
||||||
|
return lastValueFrom(this.http.patch<T>(path, body, options));
|
||||||
|
}
|
||||||
|
|
||||||
async deleteRequest<T>(path: string, headers?: Record<string, string>): Promise<T> {
|
async deleteRequest<T>(path: string, headers?: Record<string, string>): Promise<T> {
|
||||||
const options = {
|
const options = {
|
||||||
observe: 'response' as const,
|
observe: 'response' as const,
|
||||||
@ -38,9 +43,4 @@ export class HttpService {
|
|||||||
statusCode: response.status
|
statusCode: response.status
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
async patchRequest<T>(path: string, body: any = {}, headers?: Record<string, string>): Promise<T> {
|
|
||||||
const options = headers ? { headers: new HttpHeaders(headers) } : {};
|
|
||||||
return lastValueFrom(this.http.patch<T>(path, body, options));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -52,10 +52,10 @@ export class MeetingService {
|
|||||||
* @param newRole - The new role to be assigned to the participant
|
* @param newRole - The new role to be assigned to the participant
|
||||||
*/
|
*/
|
||||||
async changeParticipantRole(roomId: string, participantIdentity: string, newRole: string): Promise<void> {
|
async changeParticipantRole(roomId: string, participantIdentity: string, newRole: string): Promise<void> {
|
||||||
const path = `${this.MEETINGS_API}/${roomId}/participants/${participantIdentity}`;
|
const path = `${this.MEETINGS_API}/${roomId}/participants/${participantIdentity}/role`;
|
||||||
const headers = this.participantService.getParticipantRoleHeader();
|
const headers = this.participantService.getParticipantRoleHeader();
|
||||||
const body = { role: newRole };
|
const body = { role: newRole };
|
||||||
await this.httpService.patchRequest(path, body, headers);
|
await this.httpService.putRequest(path, body, headers);
|
||||||
this.log.d(`Changed role of participant '${participantIdentity}' to '${newRole}' in room '${roomId}'`);
|
this.log.d(`Changed role of participant '${participantIdentity}' to '${newRole}' in room '${roomId}'`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user