I'm implementing a route resolver but I'm having type issues and I'm not sure how to resolve.
I'm navigating to a Group page like a social media group and I want to resolve the Group Data before routing to the page so I'm using a resolver.
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<IGroup> {
const groupId = route.paramMap.get('id');
const test = this.groupDataService.getMyGroup(groupId);
return test;
}
The problem is that my groupDateService
is returning a document reference.
getMyGroup(id) {
const userGroup: firebase.firestore.DocumentReference = firebase.firestore().doc(`groups/${id}`);
return userGroup.get();
}
I'm not sure how to make these types match. When the groupDataService
returns the document I need it to be of type IGroup
.
Any help would be greatly appreciated.