Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/data/shopping-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ export const saveEdit = (
itemId: number,
name: string
): Promise<ShoppingListItem> =>
hass.callApi("POST", "shopping_list/item/" + itemId, {
hass.callWS({
type: "shopping_list/items/update",
item_id: itemId,
name,
});

Expand All @@ -25,7 +27,9 @@ export const completeItem = (
itemId: number,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realize now that this is a bit weird, we shouldn't have 2 methods that call same function. The functions in data/* should be modeled after the APIs, not how it's used in our web components.

We should merge these two methods, like this: https://github.com/home-assistant/home-assistant-polymer/blob/8ad5280501e3e5b91a48f740df39956bb3c11616/src/panels/config/cloud/data.ts#L7-L18

(Yes, this method should be under data/cloud.ts which I'll fix in a future PR)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ll do so in my next pr. Thanks!

complete: boolean
): Promise<void> =>
hass.callApi("POST", "shopping_list/item/" + itemId, {
hass.callWS({
type: "shopping_list/items/update",
item_id: itemId,
complete,
});

Expand Down