diff --git a/src/main/scala/outwatchapp/OutwatchApp.scala b/src/main/scala/outwatchapp/OutwatchApp.scala index 61961ef..fab32df 100644 --- a/src/main/scala/outwatchapp/OutwatchApp.scala +++ b/src/main/scala/outwatchapp/OutwatchApp.scala @@ -7,6 +7,7 @@ import sttp.client.impl.monix.FetchMonixBackend import org.scalajs.dom.document import scala.scalajs.js.annotation.JSImport import scalajs.js +import outwatch.router.AppRouter @JSImport("bootstrap/dist/css/bootstrap.min.css", JSImport.Namespace) @js.native @@ -23,8 +24,8 @@ object BootstrapBundleJs extends js.Object object BlkDesignSys extends js.Object 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 backend = FetchMonixBackend() } yield new MainApp(el)(backend, store) @@ -37,7 +38,9 @@ object OutwatchApp extends BIOApp { el.setAttribute("id", "#app") document.body.appendChild(el) - app(el) + val router = Router.router + + app(el, router) .flatMap(_.run) .onErrorHandle(ex => UIO(ex.printStackTrace())) .as(ExitCode.Success)