Skip to content

Commit cec57d3

Browse files
NightlyNexusJSMonk
authored andcommitted
Remove unnecessary window.location.origin usage.
1 parent 2bcc5ef commit cec57d3

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/jsMain/kotlin/Api.kt

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,23 @@ import io.ktor.serialization.kotlinx.json.*
77

88
import kotlinx.browser.window
99

10-
val endpoint = window.location.origin // only needed until https://github.com/ktorio/ktor/issues/1695 is resolved
11-
1210
val jsonClient = HttpClient {
1311
install(ContentNegotiation) {
1412
json()
1513
}
1614
}
1715

1816
suspend fun getShoppingList(): List<ShoppingListItem> {
19-
return jsonClient.get(endpoint + ShoppingListItem.path).body()
17+
return jsonClient.get(ShoppingListItem.path).body()
2018
}
2119

2220
suspend fun addShoppingListItem(shoppingListItem: ShoppingListItem) {
23-
jsonClient.post(endpoint + ShoppingListItem.path) {
21+
jsonClient.post(ShoppingListItem.path) {
2422
contentType(ContentType.Application.Json)
2523
setBody(shoppingListItem)
26-
}
24+
}
2725
}
2826

2927
suspend fun deleteShoppingListItem(shoppingListItem: ShoppingListItem) {
30-
jsonClient.delete(endpoint + ShoppingListItem.path + "/${shoppingListItem.id}")
31-
}
28+
jsonClient.delete(ShoppingListItem.path + "/${shoppingListItem.id}")
29+
}

0 commit comments

Comments
 (0)