Add `.reset` action to `Home`

This is here for convenience while we are in the "placeholder" stages,
to give a way to navigate to the "App" screen from Home
This commit is contained in:
Daniel Haight 2021-12-14 00:20:56 +00:00
parent c035bed146
commit 8ec6494044
3 changed files with 10 additions and 0 deletions

View File

@ -37,6 +37,8 @@ extension AppReducer {
switch action {
case let .updateRoute(route):
state.route = route
case .home(.reset):
state.route = .startup
case .onboarding(.createNewWallet):
state.route = .home
default:

View File

@ -19,6 +19,7 @@ enum HomeAction: Equatable {
case updateRoute(HomeState.Route?)
case transactionHistory(TransactionHistoryAction)
case profile(ProfileAction)
case reset
}
// MARK: - HomeReducer
@ -46,6 +47,8 @@ extension HomeReducer {
return ProfileEnvironment()
})
.run(&state, action, ())
case .reset:
return .none
}
}
}

View File

@ -60,6 +60,11 @@ struct HomeView: View {
action: { viewStore.toggleSelectedTransaction() },
label: { Text("Toggle Selected Transaction") }
)
Button(
action: { viewStore.send(.reset) },
label: { Text("Reset (to startup)") }
)
}
}
}