更新代码
This commit is contained in:
@@ -423,12 +423,16 @@ class AccountServiceImpl : AccountService {
|
||||
override suspend fun loginUserWithGoogle(googleId: String): UserAuth {
|
||||
val resp = ApiClient.api.login(LoginUserRequestBody(googleId = googleId))
|
||||
val body = resp.body() ?: throw ServiceException("Failed to login")
|
||||
|
||||
return UserAuth(0, body.token)
|
||||
}
|
||||
|
||||
override suspend fun regiterUserWithGoogleAccount(idToken: String) {
|
||||
val resp = ApiClient.api.registerWithGoogle(GoogleRegisterRequestBody(idToken))
|
||||
if (resp.code() != 200) {
|
||||
if (!resp.isSuccessful) {
|
||||
parseErrorResponse(resp.errorBody())?.let {
|
||||
throw it.toServiceException()
|
||||
}
|
||||
throw ServiceException("Failed to register")
|
||||
}
|
||||
}
|
||||
@@ -472,7 +476,13 @@ class AccountServiceImpl : AccountService {
|
||||
}
|
||||
|
||||
override suspend fun changeAccountPassword(oldPassword: String, newPassword: String) {
|
||||
ApiClient.api.changePassword(ChangePasswordRequestBody(oldPassword, newPassword))
|
||||
val resp = ApiClient.api.changePassword(ChangePasswordRequestBody(oldPassword, newPassword))
|
||||
if (!resp.isSuccessful) {
|
||||
parseErrorResponse(resp.errorBody())?.let {
|
||||
throw it.toServiceException()
|
||||
}
|
||||
throw ServiceException("Failed to change password")
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun getMyLikeNotice(page: Int, pageSize: Int): ListContainer<AccountLike> {
|
||||
|
||||
Reference in New Issue
Block a user