validate user permision on chat

This commit is contained in:
Peter Maquiran
2024-08-23 11:10:52 +01:00
parent 92b2b33e46
commit c9b50620fe
20 changed files with 253 additions and 99 deletions
@@ -11,6 +11,7 @@ import { HttpErrorResponse } from '@angular/common/http';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service'
import { ChatServiceService } from 'src/app/module/chat/domain/chat-service.service'
import { UDate } from 'src/app/utils/date';
import { ToastService } from 'src/app/services/toast.service';
@Component({
selector: 'app-new-group',
@@ -53,7 +54,8 @@ export class NewGroupPage implements OnInit{
private RouteService: RouteService,
private viewContainerRef: ViewContainerRef,
private httpErrorHandle: HttpErrorHandle,
private ChatServiceService: ChatServiceService
private ChatServiceService: ChatServiceService,
private toastService: ToastService,
)
{
this.loggedUserChat = SessionStore.user.ChatData['data'];
@@ -130,9 +132,11 @@ export class NewGroupPage implements OnInit{
})
if(result.isOk()) {
this.addGroupMessage.emit(result.value.data.id);
this.addGroupMessage.emit(result.value.id);
} else if(result.error instanceof HttpErrorResponse) {
this.httpErrorHandle.httpStatusHandle(result.error)
} else {
this.toastService._badRequest('Por favor, contacta um administrador.');
}
}