Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

Commit

Permalink
Merge pull request #768 from SuperViz/lab
Browse files Browse the repository at this point in the history
Lab
  • Loading branch information
carlossantos74 authored Sep 16, 2024
2 parents efef5d6 + 6d612a0 commit f69ddd7
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 24 deletions.
4 changes: 1 addition & 3 deletions src/components/comments/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,7 @@ describe('Comments', () => {
const spy = jest.spyOn(ApiService, 'fetchAnnotation');

expect(spy).toHaveBeenCalledWith(MOCK_CONFIG.apiUrl, MOCK_CONFIG.apiKey, {
roomId: MOCK_CONFIG.roomId,
url: expect.any(String),
roomId: MOCK_CONFIG.roomId
});
});

Expand All @@ -161,7 +160,6 @@ describe('Comments', () => {

expect(spy).toHaveBeenCalledWith(MOCK_CONFIG.apiUrl, MOCK_CONFIG.apiKey, {
roomId: MOCK_CONFIG.roomId,
url: expect.any(String),
userId: expect.any(String),
position: expect.any(String),
});
Expand Down
15 changes: 0 additions & 15 deletions src/components/comments/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,18 +134,6 @@ export class Comments extends BaseComponent {
);
}

/**
* @function url
* @description Gets the URL of the client
* @returns {void}
*/
private get url(): string {
const url = new URL(this.clientUrl);
url.search = '';

return url.toString();
}

/**
* @function start
* @description Initializes the Comments component
Expand Down Expand Up @@ -392,15 +380,13 @@ export class Comments extends BaseComponent {
private createAnnotation = async ({ detail }: CustomEvent): Promise<void> => {
try {
const { text, mentions } = detail;
const { url } = this;
const position = { ...this.coordinates };
const annotation = await ApiService.createAnnotations(
config.get<string>('apiUrl'),
config.get<string>('apiKey'),
{
roomId: config.get<string>('roomId'),
position: JSON.stringify(position),
url,
userId: this.localParticipantId,
},
);
Expand Down Expand Up @@ -604,7 +590,6 @@ export class Comments extends BaseComponent {

{
roomId: config.get('roomId'),
url: this.url,
},
);

Expand Down
2 changes: 0 additions & 2 deletions src/services/api/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ describe('ApiService', () => {
const baseUrl = 'https://dev.nodeapi.superviz.com';
const response = await ApiService.createAnnotations(baseUrl, VALID_API_KEY, {
roomId: 'any_room_id',
url: 'any_url',
position: 'any_position',
userId: 'any_user_id',
});
Expand All @@ -162,7 +161,6 @@ describe('ApiService', () => {
const baseUrl = 'https://dev.nodeapi.superviz.com';
const response = await ApiService.fetchAnnotation(baseUrl, VALID_API_KEY, {
roomId: 'any_room_id',
url: 'any_url',
});

expect(response).toEqual([]);
Expand Down
3 changes: 1 addition & 2 deletions src/services/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ export default class ApiService {
static async fetchAnnotation(baseUrl: string, apiKey: string, query: FetchAnnotationsParams) {
const path = '/annotations';
const url = this.createUrl(baseUrl, path, {
roomId: query.roomId,
url: query.url,
roomId: query.roomId
});
return doRequest(url, 'GET', undefined, { apikey: apiKey });
}
Expand Down
2 changes: 0 additions & 2 deletions src/services/api/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export type AnnotationParams = {
roomId: string;
url: string;
position: string;
userId: string;
};
Expand All @@ -13,7 +12,6 @@ export type CommentParams = {

export type FetchAnnotationsParams = {
roomId: string;
url: string;
}

export type MentionParams = {
Expand Down

0 comments on commit f69ddd7

Please sign in to comment.