Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
purescript-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Grégoire Locqueville
purescript-gargantext
Commits
dccaa33a
Unverified
Commit
dccaa33a
authored
Oct 11, 2018
by
Nicolas Pouillard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[REFACTOR] Annuaire.User.Users, make performAction a local def
parent
8c1bf0e6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
9 deletions
+12
-9
API.purs
src/Gargantext/Pages/Annuaire/User/Users/API.purs
+3
-5
Specs.purs
src/Gargantext/Pages/Annuaire/User/Users/Specs.purs
+9
-4
No files found.
src/Gargantext/Pages/Annuaire/User/Users/API.purs
View file @
dccaa33a
...
...
@@ -7,7 +7,7 @@ import Data.Maybe (Maybe(..))
import Effect.Aff (Aff)
import Effect.Class (liftEffect)
import Effect.Console (log)
import Thermite (
PerformAction
, modifyState)
import Thermite (
StateCoTransformer
, modifyState)
import Gargantext.Config (toUrl, NodeType(..), End(..))
import Gargantext.Config.REST (get)
...
...
@@ -17,13 +17,11 @@ import Gargantext.Prelude
getUser :: Int -> Aff (Either String User)
getUser id = get $ toUrl Back Node id
performAction :: PerformAction State {} Action
performAction (FetchUser userId) _ _ = do
fetchUser :: Int -> StateCoTransformer State Unit
fetchUser userId = do
value <- lift $ getUser userId
_ <- case value of
(Right user) -> void $ modifyState $ _user ?~ user
(Left err) -> do
logs err
logs "Fetching user..."
performAction _ _ _ = pure unit
src/Gargantext/Pages/Annuaire/User/Users/Specs.purs
View file @
dccaa33a
...
...
@@ -3,11 +3,16 @@ module Gargantext.Pages.Annuaire.User.Users.Specs
layoutUser)
where
import Gargantext.Pages.Annuaire.User.Users.Specs.Renders
import Thermite (Spec, simpleSpec)
import Gargantext.Pages.Annuaire.User.Users.Types (Action, State)
import Gargantext.Pages.Annuaire.User.Users.API (performAction)
import Thermite (PerformAction, Spec, simpleSpec)
import Gargantext.Prelude
import Gargantext.Pages.Annuaire.User.Users.Types (Action(..), State)
import Gargantext.Pages.Annuaire.User.Users.API (fetchUser)
import Gargantext.Pages.Annuaire.User.Users.Specs.Renders (render)
layoutUser :: Spec State {} Action
layoutUser = simpleSpec performAction render
where
performAction :: PerformAction State {} Action
performAction (FetchUser userId) _ _ = fetchUser userId
performAction (TabA _) _ _ = pure unit
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment