Show item detail for a shared item

This commit is contained in:
eikek
2021-10-07 22:02:31 +02:00
parent 006791deb4
commit 7cbdf919f4
18 changed files with 458 additions and 57 deletions

View File

@ -5,7 +5,7 @@
-}
module Page.Share.Data exposing (Mode(..), Model, Msg(..), PageError(..), init)
module Page.Share.Data exposing (Mode(..), Model, Msg(..), PageError(..), init, initCmd)
import Api
import Api.Model.ItemLightList exposing (ItemLightList)
@ -41,6 +41,7 @@ type alias Model =
, powerSearchInput : Comp.PowerSearchInput.Model
, searchInProgress : Bool
, itemListModel : Comp.ItemCardList.Model
, initialized : Bool
}
@ -54,17 +55,27 @@ emptyModel flags =
, powerSearchInput = Comp.PowerSearchInput.init
, searchInProgress = False
, itemListModel = Comp.ItemCardList.init
, initialized = False
}
init : Maybe String -> Flags -> ( Model, Cmd Msg )
init shareId flags =
let
em =
emptyModel flags
in
case shareId of
Just id ->
( emptyModel flags, Api.verifyShare flags (ShareSecret id Nothing) VerifyResp )
( { em | initialized = True }, Api.verifyShare flags (ShareSecret id Nothing) VerifyResp )
Nothing ->
( emptyModel flags, Cmd.none )
( em, Cmd.none )
initCmd : String -> Flags -> Cmd Msg
initCmd shareId flags =
Api.verifyShare flags (ShareSecret shareId Nothing) VerifyResp
type Msg