Skip to content

Commit

Permalink
Update #11: mypage navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
0se0 committed Dec 17, 2024
1 parent dc0fe68 commit 86a7e37
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions app/src/main/java/org/sopt/and/feature/mypage/MyPageNavigation.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package org.sopt.and.feature.mypage

import androidx.lifecycle.viewmodel.compose.viewModel
import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavOptionsBuilder
import androidx.navigation.compose.composable
import org.sopt.and.data.repository.UserRepository

const val myPageRoute = "myPageRoute"

fun NavController.navigateToMyPage(builder: NavOptionsBuilder.() -> Unit = {}) {
navigate(myPageRoute) {
builder()
}
}

fun NavGraphBuilder.myPageScreen(
onLogout: () -> Unit,
userRepository: UserRepository
) {
composable(route = myPageRoute) {
MyPageRoute(
onLogout = onLogout,
viewModel = viewModel { MyPageViewModel(userRepository) }
)
}
}

0 comments on commit 86a7e37

Please sign in to comment.