Skip to content

Commit

Permalink
Update to sjs-dom 2.0.0 (#354)
Browse files Browse the repository at this point in the history
Co-authored-by: Adam Fraser <[email protected]>
  • Loading branch information
armanbilge and adamgfraser authored Oct 24, 2021
1 parent 7dfa6b7 commit 6f3aaa0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ lazy val jshttp = project
.settings(stdSettings("zio-logging-jshttp"))
.settings(
libraryDependencies ++= Seq(
"org.scala-js" %%% "scalajs-dom" % "1.2.0"
"org.scala-js" %%% "scalajs-dom" % "2.0.0"
)
)

Expand Down
11 changes: 9 additions & 2 deletions jshttp/src/main/scala/zio/logging/js/HTTPLogger.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package zio.logging.js

import org.scalajs.dom.ext.Ajax
import org.scalajs.dom.{ Fetch, HttpMethod, RequestInit }
import zio.clock.{ Clock, currentDateTime }
import zio.logging.{ LogAnnotation, LogAppender, LogContext, LogFormat, LogLevel, Logging }
import zio.{ ZIO, ZLayer }
Expand All @@ -13,7 +13,14 @@ import scala.scalajs.js.JSON
object HTTPLogger {

private def sendMessage(url: String, msg: js.Object) =
Ajax.post(url, JSON.stringify(msg), headers = Map("Content-Type" -> "application/json"))
Fetch.fetch(
url,
new RequestInit {
method = HttpMethod.POST
body = JSON.stringify(msg)
headers = js.Dictionary("Content-Type" -> "application/json")
}
)

/**
* Parameters:
Expand Down

0 comments on commit 6f3aaa0

Please sign in to comment.