-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
set method post (configure post actions in redux), communicate this a…
…ction with server
- Loading branch information
Showing
19 changed files
with
534 additions
and
34 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import axios from 'axios'; | ||
|
||
export const postedMarkerRecord = (record) => ({ | ||
type: 'POSTED_RECORD_SUCCESS', | ||
record | ||
}) | ||
|
||
export const postedMarkerError = (error) => ({ | ||
type: 'POSTED_RECORD_ERROR', | ||
error | ||
}) | ||
|
||
export const postMarkerRecord = (record) => (dispatch) =>{ | ||
dispatch({type: 'POSTING_RECORD'}) | ||
axios.create({baseURL: 'http://localhost:8080'}).post('/markers', record) | ||
.then(res=>{ | ||
console.log(res); | ||
dispatch(postedMarkerRecord(res.data)); | ||
}) | ||
.catch(error=>{ | ||
dispatch(postedMarkerRecord(error)); | ||
}) | ||
} |
This file contains 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
Oops, something went wrong.