Skip to content

Commit

Permalink
chore: Update versions
Browse files Browse the repository at this point in the history
  • Loading branch information
patroza committed Oct 12, 2024
1 parent 1994f1c commit e593b80
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 10 deletions.
8 changes: 8 additions & 0 deletions packages/vue/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @effect-app/vue

## 1.22.3

### Patch Changes

- port
- Updated dependencies
- @effect-app/vue@1.22.3

## 1.22.2

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/vue/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@effect-app/vue",
"version": "1.22.2",
"version": "1.22.3",
"license": "MIT",
"type": "module",
"homepage": "https://github.com/effect-ts-app/libs/tree/main/packages/vue",
Expand Down
29 changes: 20 additions & 9 deletions packages/vue/src/makeClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,13 @@ export const withSuccess: {
i: any
) => Effect<any, any, ApiConfig | HttpClient.HttpClient>
)(i),
Effect.flatMap((_) => Effect.promise(() => onSuccess(_, i)))
Effect.flatMap((_) =>
Effect.promise(() => onSuccess(_, i)).pipe(
Effect.withSpan("onSuccess")
)
)
)
: Effect.flatMap(self.handler, (_) => Effect.promise(() => onSuccess(_)))
: Effect.flatMap(self.handler, (_) => Effect.promise(() => onSuccess(_)).pipe(Effect.withSpan("onSuccess")))
})

export const withSuccessE: {
Expand Down Expand Up @@ -393,17 +397,24 @@ export const makeClient = <Locale extends string>(
)
}

function makeUseAndHandleMutation(onSuccess: () => Promise<void>) {
function makeUseAndHandleMutation(
onSuccess?: () => Promise<void>,
defaultOptions?: Opts<any>
) {
return ((self: any, action: any, options: any) => {
return useAndHandleMutation(
{
handler: (typeof self.handler === "function"
? (i: any) => Effect.tap(self.handler(i), () => Effect.promise(onSuccess))
: Effect.tap(self.handler, () => Effect.promise(onSuccess))) as any,
handler: typeof self.handler === "function"
? onSuccess
? (i: any) => Effect.tap(self.handler(i), () => Effect.promise(onSuccess))
: self.handler
: onSuccess
? (Effect.tap(self.handler, () => Effect.promise(onSuccess)) as any)
: self.handler,
name: self.name
},
action,
options
{ ...defaultOptions, ...options }
)
}) as {
<I, E extends ResponseErrors, A>(
Expand All @@ -412,8 +423,8 @@ export const makeClient = <Locale extends string>(
name: string
},
action: string,
options?: Opts<A>
): Resp<I, E, A>
options?: Opts<A, I>
): Resp<I, A, E>
<E extends ResponseErrors, A>(
self: {
handler: Effect<A, E, ApiConfig | HttpClient.HttpClient>
Expand Down

0 comments on commit e593b80

Please sign in to comment.