Created
February 26, 2019 10:46
-
-
Save mohamedhamdy2017/bcf4c3680843f11069af8c82b346fc9d 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
import { IS_FETCHING, FETCHING_SUCCESS, FETCHING_FAILED } from '../actions/actionTypes' | |
const Parameters = {UID: '26.2716025' & '50.2017993'} | |
export const task_register = () => { | |
let url = 'https://wainnakel.com/api/v1/GenerateFS.php?uid=26.2716025,50.2017993&get_param=value' | |
return async (dispatch) => { | |
dispatch({type: IS_FETCHING }) | |
const res = await fetch(url, { | |
method: "POST", | |
headers: { | |
Accept: 'application/json', | |
'Content-Type': 'application/json', | |
}, | |
body: JSON.stringify({ | |
uid: `${Parameters.UID.Longitude}${Parameters.UID.Latitude}` | |
}) | |
}) | |
const result = res.json(); | |
if(result){ | |
dispatch({FETCHING_SUCCESS, payload: result}) | |
}else { | |
dispatch({FETCHING_FAILED}) | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment