File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -7,25 +7,23 @@ import io.ktor.serialization.kotlinx.json.*
77
88import kotlinx.browser.window
99
10- val endpoint = window.location.origin // only needed until https://github.com/ktorio/ktor/issues/1695 is resolved
11-
1210val jsonClient = HttpClient {
1311 install(ContentNegotiation ) {
1412 json()
1513 }
1614}
1715
1816suspend fun getShoppingList (): List <ShoppingListItem > {
19- return jsonClient.get(endpoint + ShoppingListItem .path).body()
17+ return jsonClient.get(ShoppingListItem .path).body()
2018}
2119
2220suspend 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
2927suspend fun deleteShoppingListItem (shoppingListItem : ShoppingListItem ) {
30- jsonClient.delete(endpoint + ShoppingListItem .path + " /${shoppingListItem.id} " )
31- }
28+ jsonClient.delete(ShoppingListItem .path + " /${shoppingListItem.id} " )
29+ }
You can’t perform that action at this time.
0 commit comments