From 0b61f5a05c757dc694f5ada08a491234369208a4 Mon Sep 17 00:00:00 2001 From: Edouard Bozon Date: Wed, 3 Jan 2024 09:13:57 +0100 Subject: [PATCH] feat: add mutation retries --- projects/todo-mvc/src/app/todo.resource.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/todo-mvc/src/app/todo.resource.ts b/projects/todo-mvc/src/app/todo.resource.ts index f15dd61..9ac49a3 100644 --- a/projects/todo-mvc/src/app/todo.resource.ts +++ b/projects/todo-mvc/src/app/todo.resource.ts @@ -22,6 +22,7 @@ export class TodoResource { addOne = injectMutation(() => ({ mutationFn: (todo: Pick) => lastValueFrom(this.#http.post(TodoResource.endpoint, todo)), + retry: 5, })); removeOne = injectMutation(() => ({ @@ -29,6 +30,7 @@ export class TodoResource { lastValueFrom( this.#http.delete(`${TodoResource.endpoint}/${todo.id}`) ), + retry: 5, })); updateOne = injectMutation(() => ({ @@ -36,10 +38,12 @@ export class TodoResource { lastValueFrom( this.#http.put(`${TodoResource.endpoint}/${todo.id}`, todo) ), + retry: 5, })); updateMany = injectMutation(() => ({ mutationFn: (todos: Todo[]) => lastValueFrom(this.#http.put(`${TodoResource.endpoint}`, todos)), + retry: 5, })); }