Tested eve-api

This commit is contained in:
Nicole Dresselhaus 2015-07-24 21:12:18 +02:00
parent 4e3284c682
commit b739e2190f
4 changed files with 20 additions and 6 deletions

View File

@ -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}
|] |]
)

View File

@ -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

View File

@ -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

View File

@ -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>