Skip to content

Commit

Permalink
cleanup legacy
Browse files Browse the repository at this point in the history
  • Loading branch information
patroza committed Dec 3, 2024
1 parent 5ef6481 commit 73af8be
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 77 deletions.
5 changes: 5 additions & 0 deletions .changeset/real-pigs-speak.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@effect-app/vue": minor
---

Cleanup legacy
77 changes: 0 additions & 77 deletions packages/vue/src/makeClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,83 +24,6 @@ export type ResponseErrors = S.ParseResult.ParseError | SupportedErrors | Suppre
export interface Opts<A, I = void> extends MutationOptions<A, I> {
suppressErrorToast?: boolean
suppressSuccessToast?: boolean
successToast?: (a: A) => any
}

/** @deprecated - use mapHandler */
export const withSuccess: {
<I, A, E, X, R>(
self: {
handler: (i: I) => Effect<A, E, R>
name: string
},
onSuccess: (a: A, i: I) => Promise<X>
): {
handler: (i: I) => Effect<X, E, R>
name: string
}
<A, E, X, R>(
self: {
handler: Effect<A, E, R>
name: string
},
onSuccess: (_: A) => Promise<X>
): {
handler: Effect<X, E, R>
name: string
}
} = (self: any, onSuccess: any): any => ({
...self,
handler: typeof self.handler === "function"
? (i: any) =>
pipe(
(
self.handler as (
i: any
) => Effect<any, any, any>
)(i),
Effect.flatMap((_) =>
Effect.promise(() => onSuccess(_, i)).pipe(
Effect.withSpan("onSuccess")
)
)
)
: Effect.flatMap(self.handler, (_) => Effect.promise(() => onSuccess(_)).pipe(Effect.withSpan("onSuccess")))
})

/** @deprecated - use mapHandler */
export const withSuccessE: {
<I, E, A, E2, X, R>(
self: {
handler: (i: I) => Effect<A, E, R>
name: string
},
onSuccessE: (_: A, i: I) => Effect<X, E2>
): {
handler: (i: I) => Effect<X, E | E2, R>
name: string
}
<E, A, E2, X, R>(
self: {
handler: Effect<A, E, R>
name: string
},
onSuccessE: (_: A) => Effect<X, E2>
): {
handler: Effect<X, E | E2, R>
name: string
}
} = (self: any, onSuccessE: any): any => {
return {
...self,
handler: typeof self.handler === "function"
? (i: any) =>
pipe(
self.handler(i),
Effect.flatMap((_) => onSuccessE(_, i))
)
: Effect.flatMap(self.handler, (_) => onSuccessE(_))
}
}

type WithAction<A> = A & {
Expand Down

0 comments on commit 73af8be

Please sign in to comment.