await POST calls and refetch call

This commit is contained in:
Tanguy Gérôme 2026-01-06 09:00:53 +02:00
parent 3d0e9206cd
commit dbc26163d0
Signed by: tanguy
GPG key ID: 10B2947233740B88

View file

@ -90,7 +90,7 @@ function Home() {
// ============================================
const addCoffeeDialogId = 'addCoffeeDialog'
async function postNewCoffee() {
postNewEntry(
await postNewEntry(
'coffee',
{
name: addCoffeeName,
@ -98,7 +98,7 @@ function Home() {
notes: addCoffeeNotes,
}
)
queryClient.invalidateQueries({ queryKey: ['coffees'] })
await queryClient.refetchQueries({ queryKey: ['coffees'] })
closeDialog(addCoffeeDialogId)
}
function renderAddCoffeeDialog() {
@ -134,14 +134,14 @@ function Home() {
// ============================================
const addGrinderDialogId = 'addGrinderDialog'
async function postNewGrinder() {
postNewEntry(
await postNewEntry(
'grinder',
{
name: addGrinderName,
notes: addGrinderNotes,
}
)
queryClient.invalidateQueries({ queryKey: ['grinders'] })
await queryClient.refetchQueries({ queryKey: ['grinders'] })
closeDialog(addGrinderDialogId)
}
function renderAddGrinderDialog() {
@ -172,14 +172,14 @@ function Home() {
// ============================================
const addBrewerDialogId = 'addBrewerDialog'
async function postNewBrewer() {
postNewEntry(
await postNewEntry(
'brewer',
{
name: addBrewerName,
notes: addBrewerNotes,
}
)
queryClient.invalidateQueries({ queryKey: ['brewers'] })
await queryClient.refetchQueries({ queryKey: ['brewers'] })
closeDialog(addBrewerDialogId)
}
function renderAddBrewerDialog() {
@ -210,7 +210,7 @@ function Home() {
// ============================================
const addMethodDialogId = 'addMethodDialog'
async function postNewMethod() {
postNewEntry(
await postNewEntry(
'method',
{
coffeeId: addMethodCoffeeId,
@ -225,7 +225,7 @@ function Home() {
notes: addMethodNotes,
}
)
queryClient.invalidateQueries({ queryKey: ['methods'] })
await queryClient.refetchQueries({ queryKey: ['methods'] })
closeDialog(addMethodDialogId)
}
function renderAddMethodDialog() {