Skip to content

Commit

Permalink
FEAT/#17: SignUpRepository 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
youjin09222 committed Jun 7, 2024
1 parent 3c6d0c1 commit 741dc9f
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.sopt.now.test.data.repository

import com.sopt.now.test.core.view.UiState
import com.sopt.now.test.data.ServicePool
import com.sopt.now.test.data.dto.request.RequestSignUpDto
import com.sopt.now.test.data.dto.response.ResponseAuthDto
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext

class SignUpRepository {
suspend fun postSignUp(requestSignUp: RequestSignUpDto): UiState<ResponseAuthDto> {
return withContext(Dispatchers.IO) {
runCatching {
ServicePool.authService.postSignUp(requestSignUp)
}.fold(
{ UiState.Success(it) },
{ UiState.Failure(it.message.toString()) }
)
}
}
}

0 comments on commit 741dc9f

Please sign in to comment.