@@ -8,21 +8,20 @@ module Registry.Api.Organizations exposing
8
8
9
9
import Json.Encode as E
10
10
import Registry.Api.Models.Organization as Organization exposing (Organization )
11
- import Registry.Api.Requests as Requests
12
- import Registry.Data.AppState exposing (AppState )
11
+ import Registry.Data.AppState as AppState exposing (AppState )
13
12
import Registry.Data.Forms.OrganizationForm as OrganizationForm exposing (OrganizationForm )
14
13
import Registry.Data.Forms.SignupForm as SignupForm exposing (SignupForm )
15
- import Shared.Api exposing (ToMsg )
14
+ import Shared.Api.Request as Requests exposing (ToMsg )
16
15
17
16
18
17
getOrganization : AppState -> String -> ToMsg Organization msg -> Cmd msg
19
18
getOrganization appState organizationId =
20
- Requests . get appState ( " /organizations/" ++ organizationId) Organization . decoder
19
+ Requests . get ( AppState . toServerInfo appState) ( " /organizations/" ++ organizationId) Organization . decoder
21
20
22
21
23
22
postOrganization : AppState -> SignupForm -> ToMsg () msg -> Cmd msg
24
23
postOrganization appState form =
25
- Requests . postWhatever appState " /organizations" ( SignupForm . encode form)
24
+ Requests . postWhatever ( AppState . toServerInfo appState) " /organizations" ( SignupForm . encode form)
26
25
27
26
28
27
putOrganization : AppState -> String -> OrganizationForm -> ToMsg Organization msg -> Cmd msg
@@ -31,7 +30,7 @@ putOrganization appState organizationId formData =
31
30
body =
32
31
OrganizationForm . encode formData
33
32
in
34
- Requests . put appState ( " /organizations/" ++ organizationId) Organization . decoder body
33
+ Requests . put ( AppState . toServerInfo appState) ( " /organizations/" ++ organizationId) Organization . decoder body
35
34
36
35
37
36
putOrganizationState : AppState -> { organizationId : String , hash : String , active : Bool } -> ToMsg Organization msg -> Cmd msg
@@ -40,9 +39,9 @@ putOrganizationState appState { organizationId, hash, active } =
40
39
body =
41
40
E . object [ ( " active" , E . bool active ) ]
42
41
in
43
- Requests . put appState ( " /organizations/" ++ organizationId ++ " /state?hash=" ++ hash) Organization . decoder body
42
+ Requests . put ( AppState . toServerInfo appState) ( " /organizations/" ++ organizationId ++ " /state?hash=" ++ hash) Organization . decoder body
44
43
45
44
46
45
putOrganizationToken : AppState -> { organizationId : String , hash : String } -> ToMsg Organization msg -> Cmd msg
47
46
putOrganizationToken appState { organizationId, hash } =
48
- Requests . putEmpty appState ( " /organizations/" ++ organizationId ++ " /token?hash=" ++ hash) Organization . decoder
47
+ Requests . putEmptyBody ( AppState . toServerInfo appState) ( " /organizations/" ++ organizationId ++ " /token?hash=" ++ hash) Organization . decoder
0 commit comments