mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
pass sole arg to cardStats as a dictionary
Easier to extend in the future, or (de)serialize in a strongly-typed language.
This commit is contained in:
parent
abad6c3844
commit
e8c5802a96
2 changed files with 3 additions and 2 deletions
|
@ -413,7 +413,8 @@ def complete_tag() -> bytes:
|
|||
|
||||
|
||||
def card_stats() -> bytes:
|
||||
return aqt.mw.col.card_stats_data(CardId(int(request.data)))
|
||||
args = from_json_bytes(request.data)
|
||||
return aqt.mw.col.card_stats_data(CardId(args["cardId"]))
|
||||
|
||||
|
||||
# these require a collection
|
||||
|
|
|
@ -6,6 +6,6 @@ import { postRequest } from "../lib/postrequest";
|
|||
|
||||
export async function getCardStats(cardId: number): Promise<Stats.CardStatsResponse> {
|
||||
return Stats.CardStatsResponse.decode(
|
||||
await postRequest("/_anki/cardStats", JSON.stringify(cardId))
|
||||
await postRequest("/_anki/cardStats", JSON.stringify({ cardId }))
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue