Minor correction to main class

This commit is contained in:
Rohan Sircar 2020-12-29 12:34:32 +05:30
parent e5c3802e92
commit c502f2e1c9

View File

@ -7,6 +7,7 @@ import sttp.client.impl.monix.FetchMonixBackend
import org.scalajs.dom.document import org.scalajs.dom.document
import scala.scalajs.js.annotation.JSImport import scala.scalajs.js.annotation.JSImport
import scalajs.js import scalajs.js
import outwatch.router.AppRouter
@JSImport("bootstrap/dist/css/bootstrap.min.css", JSImport.Namespace) @JSImport("bootstrap/dist/css/bootstrap.min.css", JSImport.Namespace)
@js.native @js.native
@ -23,8 +24,8 @@ object BootstrapBundleJs extends js.Object
object BlkDesignSys extends js.Object object BlkDesignSys extends js.Object
object OutwatchApp extends BIOApp { object OutwatchApp extends BIOApp {
val router = Router.router
def app(el: Element) = for { def app(el: Element, router: AppRouter[Task, Page]) = for {
store <- router.store store <- router.store
backend = FetchMonixBackend() backend = FetchMonixBackend()
} yield new MainApp(el)(backend, store) } yield new MainApp(el)(backend, store)
@ -37,7 +38,9 @@ object OutwatchApp extends BIOApp {
el.setAttribute("id", "#app") el.setAttribute("id", "#app")
document.body.appendChild(el) document.body.appendChild(el)
app(el) val router = Router.router
app(el, router)
.flatMap(_.run) .flatMap(_.run)
.onErrorHandle(ex => UIO(ex.printStackTrace())) .onErrorHandle(ex => UIO(ex.printStackTrace()))
.as(ExitCode.Success) .as(ExitCode.Success)