Commit 8bd01030 authored by Emmanuel Raviart's avatar Emmanuel Raviart

Add authentication to autocompletion requests to bypass HTTP cache.

parent e9dab3a2
module Cards.Autocomplete.State exposing (..)
import Authenticator.Types exposing (Authentication)
import Autocomplete
import Cards.Autocomplete.Types exposing (..)
import Dom
......@@ -101,8 +102,8 @@ subscriptions model =
Sub.map AutocompleteMsg Autocomplete.subscription
update : InternalMsg -> I18n.Language -> String -> Model -> ( Model, Cmd Msg )
update msg language fieldId model =
update : InternalMsg -> Maybe Authentication -> I18n.Language -> String -> Model -> ( Model, Cmd Msg )
update msg authentication language fieldId model =
case msg of
AutocompleteMsg childMsg ->
let
......@@ -122,7 +123,7 @@ update msg language fieldId model =
( newModel, Cmd.none )
Just newMsg ->
update newMsg language fieldId newModel
update newMsg authentication language fieldId newModel
Focus ->
model ! []
......@@ -156,7 +157,7 @@ update msg language fieldId model =
LoadMenu ->
( { model | autocompleteMenuState = AutocompleteMenuLoading }
, Requests.autocompleteCards
Nothing
authentication
language
model.cardTypes
model.autocomplete
......@@ -169,7 +170,7 @@ update msg language fieldId model =
AutocompleteMenuSleeping ->
( { model | autocompleteMenuState = AutocompleteMenuLoading }
, Requests.autocompleteCards
Nothing
authentication
language
model.cardTypes
model.autocomplete
......@@ -245,7 +246,7 @@ update msg language fieldId model =
Wrap toTop ->
case model.selected of
Just selected ->
update Reset language fieldId model
update Reset authentication language fieldId model
Nothing ->
let
......
......@@ -192,7 +192,9 @@ update msg model =
KeysAutocompleteMsg childMsg ->
let
( keysAutocompleteModel, childCmd ) =
Properties.KeysAutocomplete.State.update childMsg
Properties.KeysAutocomplete.State.update
childMsg
model.authentication
model.language
"keyId"
model.keysAutocompleteModel
......
......@@ -348,7 +348,9 @@ update msg model =
ToolsAutocompleteMsg childMsg ->
let
( toolsAutocompleteModel, childCmd ) =
Cards.Autocomplete.State.update childMsg
Cards.Autocomplete.State.update
childMsg
model.authentication
model.language
"toolsAutocomplete"
model.toolsAutocompleteModel
......@@ -360,7 +362,9 @@ update msg model =
UseCasesAutocompleteMsg childMsg ->
let
( useCasesAutocompleteModel, childCmd ) =
Cards.Autocomplete.State.update childMsg
Cards.Autocomplete.State.update
childMsg
model.authentication
model.language
"useCasesAutocomplete"
model.useCasesAutocompleteModel
......
module Properties.KeysAutocomplete.State exposing (..)
import Authenticator.Types exposing (Authentication)
import Autocomplete
import Dom
import Http
......@@ -101,8 +102,8 @@ subscriptions model =
Sub.map AutocompleteMsg Autocomplete.subscription
update : InternalMsg -> I18n.Language -> String -> Model -> ( Model, Cmd Msg )
update msg language fieldId model =
update : InternalMsg -> Maybe Authentication -> I18n.Language -> String -> Model -> ( Model, Cmd Msg )
update msg authentication language fieldId model =
case msg of
AutocompleteMsg childMsg ->
let
......@@ -122,7 +123,7 @@ update msg language fieldId model =
( newModel, Cmd.none )
Just newMsg ->
update newMsg language fieldId newModel
update newMsg authentication language fieldId newModel
Focus ->
model ! []
......@@ -156,7 +157,7 @@ update msg language fieldId model =
LoadMenu ->
( { model | autocompleteMenuState = AutocompleteMenuLoading }
, Requests.autocompletePropertiesKeys
Nothing
authentication
language
model.cardTypes
model.autocomplete
......@@ -169,7 +170,7 @@ update msg language fieldId model =
AutocompleteMenuSleeping ->
( { model | autocompleteMenuState = AutocompleteMenuLoading }
, Requests.autocompletePropertiesKeys
Nothing
authentication
language
model.cardTypes
model.autocomplete
......@@ -245,7 +246,7 @@ update msg language fieldId model =
Wrap toTop ->
case model.selected of
Just selected ->
update Reset language fieldId model
update Reset authentication language fieldId model
Nothing ->
let
......
......@@ -288,7 +288,9 @@ update msg model =
CardsAutocompleteMsg childMsg ->
let
( cardsAutocompleteModel, childCmd ) =
Cards.Autocomplete.State.update childMsg
Cards.Autocomplete.State.update
childMsg
model.authentication
model.language
"cardId"
model.cardsAutocompleteModel
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment