Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const axios = require('axios')
- const publicIp = require('public-ip');
- const localip = require('local-ip');
- const _this = this;
- const registerPartner = () => {
- /* const dataToSend = {
- id_cliente: 1,
- ip: `${getLocalIP()}, ${getPublicIP()}`, //"10.211.55.2"
- }; */
- const dataToSend = {
- id_cliente: 6,
- ip: "10.211.55.2"
- }
- axios.post('http://pedravirada.ddns.net:8081/zealplus/srv_registra_cliente/', { dataToSend })
- .then((res) => {
- console.log('registerPartner', res.data);
- //console.log('PublicIP', getPublicIP());
- return res.data
- })
- .catch((error) => {
- console.log(error);
- });
- };
- const getPublicIP = () => {
- publicIp.v4().then(ip => {
- console.log(ip);
- //=> '46.5.21.123'
- return ip;
- });
- };
- //var iface = 'wlan0';
- const getLocalIP = () => {
- localip('wlan0', (err, res) => {
- if (err) {
- throw new Error('I have no idea what my local ip is.');
- }
- console.log('My local ip address on ' + iface + ' is ' + res);
- });
- };
- module.exports = {registerPartner};
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement