Tested eve-api
This commit is contained in:
		| @@ -2,13 +2,23 @@ module Handler.Wallet where | |||||||
|  |  | ||||||
| import Import | import Import | ||||||
|  |  | ||||||
|  | import Eve.Api.Char | ||||||
|  | import Eve.Api.Types as T | ||||||
|  |  | ||||||
| getWalletR :: Handler Html | getWalletR :: Handler Html | ||||||
| getWalletR = do | getWalletR = loginOrDo $ (\(uid,user) -> do | ||||||
|  |              man <- getHttpManager <$> ask | ||||||
|  |              apiKey <- runDB $ getBy $ UniqueApiUser uid | ||||||
|  |              acc <- case apiKey of | ||||||
|  |                       Just (Entity _ (Api _ k v)) -> do | ||||||
|  |                           a <- liftIO $ getAccountBalance man (ApiComplete (T.ApiKey (VCode v) (KeyId k)) (T.CharacterId (userCharId user))) | ||||||
|  |                           return (Just a) | ||||||
|  |                       Nothing -> return Nothing | ||||||
|              defaultLayout $ [whamlet| |              defaultLayout $ [whamlet| | ||||||
|              <h1>Transactions in the last xx hours |              <h1>Transactions in the last xx hours | ||||||
|  |  | ||||||
|              <h1>Statistices for the last xx days |              <h1>Statistices for the last xx days | ||||||
|               |              #{show acc} | ||||||
|              |]  |              |] | ||||||
|  |              ) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -3,7 +3,9 @@ | |||||||
| mkdir deps | mkdir deps | ||||||
| cd deps | cd deps | ||||||
| git clone https://github.com/Drezil/yesod-auth-oauth2 | git clone https://github.com/Drezil/yesod-auth-oauth2 | ||||||
|  | git clone https://github.com/Drezil/eve-api | ||||||
| cd .. | cd .. | ||||||
| cabal sandbox init | cabal sandbox init | ||||||
| cabal sandbox add-source deps/yesod-auth-oauth2 | cabal sandbox add-source deps/yesod-auth-oauth2 | ||||||
|  | cabal sandbox add-source deps/eve-api | ||||||
| cabal install --only-dependencies | cabal install --only-dependencies | ||||||
|   | |||||||
| @@ -84,10 +84,11 @@ library | |||||||
|                  , unordered-containers |                  , unordered-containers | ||||||
|                  , containers |                  , containers | ||||||
|                  , vector |                  , vector | ||||||
|                  , time |                  , time                          >= 1.5 | ||||||
|                  , HTTP |                  , HTTP | ||||||
|                  , xml-lens |                  , xml-lens | ||||||
|                  , xml-conduit |                  , xml-conduit | ||||||
|  |                  , eve-api | ||||||
|  |  | ||||||
|  |  | ||||||
| executable         neat | executable         neat | ||||||
|   | |||||||
| @@ -34,12 +34,13 @@ $newline never | |||||||
|               <span class="icon-bar"> |               <span class="icon-bar"> | ||||||
|               <span class="icon-bar"> |               <span class="icon-bar"> | ||||||
|               <span class="icon-bar"> |               <span class="icon-bar"> | ||||||
|             <a class="navbar-brand" href="#">Brand |             <a class="navbar-brand" href="@{HomeR}">NEAT | ||||||
|  |  | ||||||
|           <!-- Collect the nav links, forms, and other content for toggling --> |           <!-- Collect the nav links, forms, and other content for toggling --> | ||||||
|           <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> |           <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> | ||||||
|             <ul class="nav navbar-nav"> |             <ul class="nav navbar-nav"> | ||||||
|               <li><a href="@{HomeR}">Home</a> |               <li><a href="@{HomeR}">Home</a> | ||||||
|  |               <li><a href="@{WalletR}">Transactions</a> | ||||||
|               <li><a href="@{SettingsR}">Settings</a> |               <li><a href="@{SettingsR}">Settings</a> | ||||||
|               <!--li class="dropdown"> |               <!--li class="dropdown"> | ||||||
|                 <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span> |                 <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user