Implementing the profile service
In this section, we'll build the profile service, which contains the code for interacting with the user's profile. This service injects the generated SetUserBioGQL, SetUserPhotoGQL, and SetUserCoverGQL services and implements the setUserBio(), setUserPhoto(), and setUserCover() methods, which simply send the necessary mutations to the backend:
- Import the following symbols into the
users/services/profile/profile.service.tsfile (which was created in the previous chapter):import { SetUserCoverGQL, SetUserPhotoGQL, SetUserBioGQL } from 'src/app/core'; import { map } from 'rxjs/operators';
Using the constructor, inject Apollo services:
export class ProfileService {
constructor(
private setUserBioGQL: SetUserBioGQL,
private setUserPhotoGQL: SetUserPhotoGQL,
private setUserCoverGQL: SetUserCoverGQL...