Created
January 11, 2016 12:40
-
-
Save zkessin/9658e2e4091db66d466a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
loadData : CRMBox.Crm -> ModelEnc -> ( CrmData, Effects.Effects Action ) | |
loadData crm data = | |
case crm of | |
CRMBox.Streak -> | |
let | |
streak = | |
Result.withDefault { apiKey = "", currentCrmAction = "", pipeline = "" } | |
<| Json.Decode.decodeValue loadStreakData data.crmData | |
( sdata, action ) = | |
Streak.init streak.currentCrmAction streak.apiKey streak.pipeline | |
in | |
( StreakModel sdata | |
, Effects.map CrmDispatch.StreakAction action | |
) | |
CRMBox.Zoho -> | |
let | |
zoho = | |
Result.withDefault { token = "", currentCrmAction = "" } | |
<| Json.Decode.decodeValue loadZohoData data.crmData | |
( zdata, action ) = | |
Zoho.init zoho.currentCrmAction zoho.token | |
in | |
( ZohoModel zdata | |
, Effects.map CrmDispatch.ZohoAction action | |
) | |
loadStreakData : Json.Decode.Decoder StreakRawModel | |
loadStreakData = | |
object3 | |
StreakRawModel | |
("currentCrmAction" := string) | |
("apiKey" := string) | |
("pipeline" := string) | |
loadZohoData : Json.Decode.Decoder ZohoRawModel | |
loadZohoData = | |
object2 | |
ZohoRawModel | |
("currentCrmAction" := string) | |
("token" := string) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment