POEditor Contrubuter now fetched

This commit is contained in:
UKDTOM 2020-06-06 20:09:20 +02:00
parent 348dc49d5f
commit 9b989e9579
2 changed files with 29 additions and 29 deletions

View file

@ -35,7 +35,8 @@ protocol.registerSchemesAsPrivileged([{scheme: 'app', privileges: { secure: true
function createWindow () {
// Create the browser window.
win = new BrowserWindow({ width: 1024, height: 768, webPreferences: {
nodeIntegration: true
nodeIntegration: true,
webSecurity: false
} })
if (process.env.WEBPACK_DEV_SERVER_URL) {

View file

@ -11,36 +11,35 @@ const mutations = {
},
};
const qs = require('querystring')
const actions = {
fetchPOEContrib({ commit }) {
axios({
method: 'post',
url: 'https://api.poeditor.com/v2/contributors/list',
headers:
{
"Access-Control-Allow-Origin": "*"
},
body:
{
'id' : '342617',
'api-token': "5166c4294ff7fb3a82cbdc82958e850e",
},
})
.then((response) => {
console.log(response)
commit('UPDATE_CONTRIBUTORS', response)
})
.catch(function (error) {
if (error.response) {
console.log(error.response.data)
alert(error.response.data.errors[0].code + " " + error.response.data.errors[0].message)
} else if (error.request) {
console.log(error.request);
} else {
console.log('Error', error.message);
}
});
const requestBody = {
id: '342617',
api_token: '5166c4294ff7fb3a82cbdc82958e850e'
}
const config = {
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
}
axios.post('https://api.poeditor.com/v2/contributors/list', qs.stringify(requestBody), config)
.then((response) => {
console.log(response)
commit('UPDATE_CONTRIBUTORS', response)
})
.catch(function (error) {
if (error.response) {
console.log(error.response.data)
alert(error.response.data.errors[0].code + " " + error.response.data.errors[0].message)
} else if (error.request) {
console.log(error.request);
} else {
console.log('Error', error.message);
}
});
}
}