-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: dropping AsyncResult and related"loading" concept
- Loading branch information
1 parent
73de9e2
commit d4e60c4
Showing
7 changed files
with
29 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
export * from './pipes/get-success.pipe'; | ||
export * from './pipes/is-error.pipe'; | ||
export * from './pipes/is-loading.pipe'; | ||
export * from './pipes/unwrap.pipe'; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
import { Pipe, PipeTransform } from '@angular/core'; | ||
import { AsyncResult, Nil, ResultError } from '@cognizone/model-utils'; | ||
import { Result, Nil, ResultError } from '@cognizone/model-utils'; | ||
|
||
@Pipe({ | ||
name: 'isError', | ||
standalone: true, | ||
}) | ||
export class IsErrorPipe implements PipeTransform { | ||
transform(value: Nil<AsyncResult>): value is ResultError<unknown> { | ||
transform(value: Nil<Result>): value is ResultError<unknown> { | ||
return value?.type === 'error'; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Pipe, PipeTransform } from '@angular/core'; | ||
import { Result } from '@cognizone/model-utils'; | ||
|
||
@Pipe({ | ||
name: 'unwrap', | ||
standalone: true, | ||
}) | ||
export class UnwrapPipe implements PipeTransform { | ||
transform<T>(value: Result<T>, defaultValue: T): T { | ||
return value.type === 'ok' ? value.content : defaultValue; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters