Last active
November 12, 2020 07:12
-
-
Save guillaumewuip/63f6f348dd8d83b369c1d6f992e37ab6 to your computer and use it in GitHub Desktop.
Revisions
-
guillaumewuip revised this gist
Nov 12, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -15,7 +15,7 @@ export const addUser = (user: User.User) => ( return { ...state, users: [...state.users, user] }; }; -
guillaumewuip revised this gist
Nov 12, 2020 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -19,7 +19,7 @@ export const addUser = (user: User.User) => ( }; }; export const isLoading = (state: State): state is Loading => // ... export const isError = (state: State): state is Failure => // ... export const canCreateUser = (state: State): boolean => //... -
guillaumewuip renamed this gist
Nov 12, 2020 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
guillaumewuip created this gist
Nov 12, 2020 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ export const decode = (apiPayload: unknown): Loaded | Failure => { // parse payload // remove admins // if something goes wrong, return Failure }; export const users = (state: Loaded) => state.users; export const addUser = (user: User.User) => ( state: Loaded ): Loaded | Failure => { if (state.users.length >= 10) { return new Error("oops"); } return { ...state, users: NonEmptyArray.snoc(state.users, user) }; }; export const isLoading = (state: State): state is Loading => ...; export const isError = (state: State): state is Failure => ...; export const canCreateUser = (state: State): boolean => ...;