@@ -19,17 +19,17 @@ const actions: PolarActionTree<RoutingState, RoutingGetters> = {
1919 state,
2020 } ) {
2121 console . error ( configuration )
22- dispatch ( 'initializeConfigStyle' )
22+ dispatch ( 'initializeConfigStyle' ) // testen
2323 drawLayer = createDrawLayer ( drawSource )
24- map . addLayer ( drawLayer )
24+ map . addLayer ( drawLayer ) // testen, ob es passiert ist
2525 console . error ( map . getLayers ( ) . getArray ( ) )
2626 map . on ( 'click' , function ( event ) {
2727 const formattedCoordinate = event . coordinate
2828 console . error ( 'formatierte Koordinate: ' + formattedCoordinate )
2929
3030 // prüfen, ob im state schon startAddress vorhanden ist - falls ja, die neue Koordinate als endAddress speichern
3131 if ( state . start . length === 0 ) {
32- commit ( 'setStart' , formattedCoordinate )
32+ commit ( 'setStart' , formattedCoordinate ) // wurde setStart als commit aufgerufen und meine formatierte Coordinate reingeschrieben? Im State überprüfen
3333 } else if ( state . end . length === 0 ) {
3434 commit ( 'setEnd' , formattedCoordinate )
3535 }
@@ -84,7 +84,7 @@ const actions: PolarActionTree<RoutingState, RoutingGetters> = {
8484 console . error ( 'Die übergebene URL: ' , url )
8585 const fetchDirections = async ( ) => {
8686 try {
87- const response = await fetch ( url , {
87+ const response = await fetch ( url , {
8888 method : 'POST' ,
8989 headers : {
9090 'Content-Type' : 'application/json' ,
@@ -123,6 +123,28 @@ const actions: PolarActionTree<RoutingState, RoutingGetters> = {
123123 }
124124 fetchDirections ( )
125125 } ,
126+ createSearchUrl ( searchInput ) {
127+ const url =
128+ 'https://geodienste.hamburg.de/HH_WFS_GAGES?service=WFS&request=GetFeature&version=2.0.0&StoredQuery_ID=findeStrasse&strassenname=' +
129+ searchInput
130+ return url
131+ } ,
132+ async sendSearchRequest ( { dispatch, state } , searchInput ) {
133+ const url = dispatch ( 'createSearchUrl' , searchInput )
134+ if ( searchInput . length >= state . minLength ) {
135+ try {
136+ const response = await fetch ( url , {
137+ method : 'GET' ,
138+ } )
139+ if ( ! response . ok ) {
140+ throw new Error ( `HTTP error! Status: ${ response . status } ` )
141+ }
142+ console . error ( response . text ( ) )
143+ } catch ( error ) {
144+ console . error ( 'send Search Error' , error )
145+ }
146+ }
147+ } ,
126148 drawRoute ( { rootGetters : { configuration } , state } ) {
127149 console . error ( `stored response: ` , state . searchResponseData )
128150 const transformedCoordinates =
0 commit comments