pledge4future/WePledge

Heating and Electricity Mutations fail

Closed this issue · 4 comments

When trying to create a heating or emission entry, the backend call fails with the following error:

[
    {
        "message": "Cannot query field \"ok\" on type \"CreateHeating\".",
        "locations": [
            {
                "line": 5,
                "column": 5
            }
        ]
    }
]

Request Payload:

{
    "operationName": "createHeating",
    "variables": {
        "timestamp": "2020-03-01",
        "consumption": 5220,
        "fuelType": "Hear pump (air)",
        "building": "205",
        "groupShare": 12,
        "unit": "l"
    },
    "query": "mutation createHeating($timestamp: Date!, $consumption: Float!, $unit: String!, $fuelType: String!, $building: String!, $groupShare: Float!) {\n  createHeating(\n    input: {timestamp: $timestamp, consumption: $consumption, unit: $unit, fuelType: $fuelType, building: $building, groupShare: $groupShare}\n  ) {\n    ok\n    __typename\n  }\n}\n"
}

We forgot to update the mutation on the frontend after changing all the ok to success in the backend mutations for the data forms (this issue exists for all dataforms)

@sami1riaz does this make it a pure frontend issue then?

Yes, I have fixed the issue in my branch. Just resolving a few more things regarding the dataforms before submitting a PR

Created a PR for this fix. Will deal with Form issues separately