fix: brew again on homepage should be instant without reload

This commit is contained in:
Jon Seager 2026-02-05 21:56:28 +00:00
parent 05c33ed533
commit af13ee472a
No known key found for this signature in database

View file

@ -74,7 +74,7 @@
<!-- Recent Brews --> <!-- Recent Brews -->
{% if !recent_brews.is_empty() %} {% if !recent_brews.is_empty() %}
<section> <section data-signals:_brewing="false">
<div class="flex items-center justify-between mb-3"> <div class="flex items-center justify-between mb-3">
<h2 class="text-lg font-semibold text-text">Recent Brews</h2> <h2 class="text-lg font-semibold text-text">Recent Brews</h2>
<a href="/data?type=brews" class="text-sm text-accent hover:text-accent-hover font-medium">View all brews &rarr;</a> <a href="/data?type=brews" class="text-sm text-accent hover:text-accent-hover font-medium">View all brews &rarr;</a>
@ -107,7 +107,8 @@
{% if is_authenticated %} {% if is_authenticated %}
<form <form
class="inline shrink-0" class="inline shrink-0"
data-on:submit="@post('/api/v1/brews', {contentType: 'form'})" data-on:submit="$_brewing = true; @post('/api/v1/brews', {contentType: 'form'})"
data-on:datastar-fetch="if (!$_brewing) return; if (evt.detail.type === 'finished') { window.location.reload() } else if (evt.detail.type === 'error') { $_brewing = false }"
> >
<input type="hidden" name="bag_id" value="{{ brew.bag_id }}" /> <input type="hidden" name="bag_id" value="{{ brew.bag_id }}" />
<input type="hidden" name="coffee_weight" value="{{ brew.coffee_weight_raw }}" /> <input type="hidden" name="coffee_weight" value="{{ brew.coffee_weight_raw }}" />