Created
February 17, 2020 11:19
-
-
Save QuadradS/3e2a8afcfff637652f1557d805c2e7a4 to your computer and use it in GitHub Desktop.
Example of user service
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { AuthJwtPayloadDTO, ChangePasswordByRecoveryTokenDTO, UserResponseDTO } from 'goin-shared' | |
import { passportApi } from '../../utils/request.util' | |
import { UserService } from '../index' | |
import { PassportApiPaths } from '../../enums/microservices-endpoints' | |
import { ComponentByName } from 'ts-framework' | |
import Injectables from '../../enums/injectables' | |
@ComponentByName(Injectables.services.user) | |
export default class DefaultService implements UserService { | |
getCurrentUser(authJwtPayload: AuthJwtPayloadDTO): Promise<UserResponseDTO> { | |
return passportApi.get(PassportApiPaths.auth.loginByCredentials, { headers: { user: String(authJwtPayload) } }) | |
} | |
updateUserPasswordByRecoveryToken(dto: ChangePasswordByRecoveryTokenDTO): Promise<void> { | |
return passportApi.patch(PassportApiPaths.user.changePasswordByRecoveryToken, dto) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment