Skip to content

Commit

Permalink
style: Apply Spotless Format
Browse files Browse the repository at this point in the history
  • Loading branch information
wnsgur1 committed Aug 28, 2024
1 parent b0a4006 commit af879a1
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import com.b1nd.dodam.network.login.model.LoginResponse

data class Member(
val accessToken: String,
val role: String
val role: String,
)

internal fun LoginResponse.toModel(): Member = Member(
accessToken = accessToken,
role = member.role
role = member.role,
)
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ fun DodamApp(
},
)
},
role = "STUDENT"
role = "STUDENT",
)
wakeupSongScreen(
onAddWakeupSongClick = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ fun DodamTeacherApp() {
loginScreen(
onBackClick = navHostController::popBackStack,
navigateToMain = {},
role = "TEACHER"
role = "TEACHER",
)
}
}
Expand Down
21 changes: 7 additions & 14 deletions feature/login/src/commonMain/kotlin/login/LoginScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,7 @@ import org.koin.compose.viewmodel.koinViewModel

@ExperimentalMaterial3Api
@Composable
internal fun LoginScreen(
viewModel: LoginViewModel = koinViewModel(),
onBackClick: () -> Unit,
navigateToMain: () -> Unit,
role: String
) {
internal fun LoginScreen(viewModel: LoginViewModel = koinViewModel(), onBackClick: () -> Unit, navigateToMain: () -> Unit, role: String) {
val uiState by viewModel.uiState.collectAsState()

var idError by remember { mutableStateOf("") }
Expand Down Expand Up @@ -127,32 +122,30 @@ private fun LoginScreen(

var showPassword by remember { mutableStateOf(false) }


if (showDialog) {
Dialog(
onDismissRequest = dismissDialog
onDismissRequest = dismissDialog,
) {
DodamDialog(
title = errorMessage,
body = "아직 계정이 승인되지 않았어요.\n" +
"승인을 기다려주세요.",
confirmButton = dismissDialog
"승인을 기다려주세요.",
confirmButton = dismissDialog,
)
}
}

if (showDialog) {
Dialog(
onDismissRequest = dismissDialog
onDismissRequest = dismissDialog,
) {
DodamDialog(
title = errorMessage,
confirmButton = dismissDialog
confirmButton = dismissDialog,
)
}
}


Scaffold(
modifier = Modifier
.fillMaxSize()
Expand All @@ -161,7 +154,7 @@ private fun LoginScreen(
topBar = {
DodamTopAppBar(
title = "아이디와 비밀번호를\n" +
"입력해주세요",
"입력해주세요",
onBackClick = onBackClick,
type = TopAppBarType.Medium,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ fun NavGraphBuilder.loginScreen(onBackClick: () -> Unit, navigateToMain: () -> U
LoginScreen(
onBackClick = onBackClick,
navigateToMain = navigateToMain,
role = role
role = role,
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,17 @@ class LoginViewModel : ViewModel(), KoinComponent {
pw = pw,
token = result.data.accessToken,

)
)
_event.emit(Event.NavigateToMain)
} else {
_event.emit(Event.ShowDialog)
_uiState.update {
it.copy(
isLoading = false,
error = "선생님만 사용 가능합니다."
error = "선생님만 사용 가능합니다.",
)
}
}

}

is Result.Error -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ data class MemberResponse(
val role: String,
val status: String,
val profileImage: String?,
val phone: String
val phone: String,
)

0 comments on commit af879a1

Please sign in to comment.