clear console.log with errors

This commit is contained in:
Peter Maquiran
2024-10-23 09:58:49 +01:00
parent bc6833b6c4
commit 4396b17909
6 changed files with 31 additions and 18 deletions
@@ -5,6 +5,9 @@ import { SignalRService } from 'src/app/infra/socket/signalR/signal-r.service';
import { HttpAdapter } from 'src/app/infra/http/adapter';
import { IMessageGetAllByRoomIdOutPut } from 'src/app/core/chat/usecase/message/message-get-all-by-room-Id';
import { IGetMessagesFromRoomParams, IMessageRemoteRepository } from 'src/app/core/chat/repository/message/message-remote-repository';
import { HttpErrorResponse } from '@angular/common/http';
import { Result } from 'neverthrow';
import { HttpResult } from 'src/app/infra/http/type';
@Injectable({
providedIn: 'root'
@@ -23,7 +26,13 @@ export class MessageRemoteDataSourceService implements IMessageRemoteRepository
// @APIReturn(MessageOutPutDTOSchema, 'get/Messages')
async getMessagesFromRoom(input: IGetMessagesFromRoomParams): DataSourceReturn<IMessageGetAllByRoomIdOutPut> {
var a = await this.http.get<IMessageGetAllByRoomIdOutPut>(`${this.baseUrl}/Room/${input.roomId}/Messages?startDate=${encodeURIComponent(input.lastMessageDate)}`)
let a: Result<HttpResult<IMessageGetAllByRoomIdOutPut>, HttpErrorResponse>
if(input.lastMessageDate) {
a = await this.http.get<IMessageGetAllByRoomIdOutPut>(`${this.baseUrl}/Room/${input.roomId}/Messages?startDate=${encodeURIComponent(input.lastMessageDate)}`)
} else {
a = await this.http.get<IMessageGetAllByRoomIdOutPut>(`${this.baseUrl}/Room/${input.roomId}/Messages`)
}
return a.map((e) => {
return e.data