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
142
Issues
142
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
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
gargantext
purescript-gargantext
Commits
9b5bcdf1
Commit
9b5bcdf1
authored
Sep 28, 2019
by
James Laver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move to multiple Auths
parent
9f55b7e1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
20 deletions
+1
-20
Login.purs
src/Gargantext/Components/Login.purs
+1
-20
No files found.
src/Gargantext/Components/Login.purs
View file @
9b5bcdf1
...
...
@@ -181,29 +181,10 @@ getAuths = pure Nothing
-- ret (Right v) = pure $ Just v
-- ret (Left e) = log2 "Error reading serialised auths:" e *> pure Nothing
setAuths :: Auths -> Effect Unit
setAuths ::
Maybe
Auths -> Effect Unit
-- setAuths Map.empty = -- window >>= localStorage >>= removeItem "auths"
setAuths _ = pure unit -- auths = window >>= localStorage >>= setItem "auths" (encodeJSON auths)
getAuthData :: Effect (Maybe AuthData)
getAuthData = do
ls <- window >>= localStorage
mto <- getItem "token" ls
mti <- getItem "tree_id" ls
pure do
token <- mto
tree_id <- Int.fromString =<< mti
pure $ AuthData {token, tree_id}
setAuthData :: Maybe AuthData -> Effect Unit
setAuthData Nothing = do
ls <- window >>= localStorage
removeItem "token" ls
removeItem "tree_id" ls
setAuthData (Just (AuthData {tree_id, token})) = do
ls <- window >>= localStorage
setItem "token" token ls
setItem "tree_id" (show tree_id) ls
-- TODO
-- useLocalStorageAuths :: String -> R.Hooks (R.State Auths)
...
...
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