Last active
July 31, 2019 20:19
-
-
Save Ackuq/602314192eae6bc19022380cf10add6d to your computer and use it in GitHub Desktop.
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
import base64 from 'react-native-base64'; | |
... | |
const auth = base64.encode(`${Config.WP_USERNAME}:${Config.WP_PASSWORD}`); | |
export const updateData = async (route, data) => { | |
try { | |
fetch(Config.API_URL + route, { | |
method: 'POST', | |
headers: { | |
Authorization: `Basic ${auth}`, | |
'Content-Type': 'application/json', | |
}, | |
body: JSON.stringify(data), | |
}); | |
} catch (error) { | |
console.error(error); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment