Skip to content

Value of isSubmitting not defined.  #3

@MarcoPalomo

Description

@MarcoPalomo

Hello guys,
Really nice content. On the Blazor trainning, I cannot finish the @layout part because of this. In the Checkout.razor file, I have a property named isSubmitting for a button :

<button class="checkout-button btn btn-warning" @onclick="PlaceOrder" disabled=@isSubmitting>

and this is obviously resulting in an error there too.

@code {
    Order Order => OrderState.Order;
    async Task PlaceOrder()
    {
        isSubmitting = true;
        var response = await HttpClient.PostAsJsonAsync($"{NavigationManager.BaseUri}orders", OrderState.Order);
        var newOrderId = await response.Content.ReadFromJsonAsync<int>();
        OrderState.ResetOrder();
        NavigationManager.NavigateTo("/myorders");
    }

}

Resulting in an error and I cannot do my dotnet watch.

error CS0103: The name 'isSubmitting' does not exist in the current context [/home/computer/Documents/sidePrj/CsharpProjects/BlazingPizza/BlazingPizza.csproj]

Please shed some lights.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions