Function Of Service
export const deviceInfoRequest = async (callback) => {
var request = new DeviceInfoMessage();
var AuthToken = 'ciOiJIUzI1NiIsInR5cCI6IkpXVCJ9';
client.deviceInfo(request, {'x-authorization': AuthToken}, (err, response) => {
var dataDevicename = response.getDevicename();
var dataDeviceid = response.getDeviceid();
console.log("DeviceName==>>>>",dataDevicename);
console.log("DeviceId==>>>>",dataDeviceid);
this.callback(dataDevicename,dataDeviceid);
});
}
=======> Result of "console.log"=="DeviceName== test" and "DeviceId==>>>> 0xdeadbeef".
Function Of Sagas
function* getDeviceInfo({ payload }) {
try {
const deviceInfoData = yield call(deviceInfoRequest, payload);
console.log("deviceInfoSagasssssssssssssssssssssss", deviceInfoData)
if (deviceInfoData.status === 200) {
yield put(showDeviceInfoAction(deviceInfoData.data));
}
} catch (error) {
}
}
=======> Result of "console.log"=="deviceInfoSagasssssssssssssssssssssss undefined"
Well you need to import that function in your "Sagas" function file, try:
import { deviceInfoRequest } from "../PATH_TO_FUNCTION";
Then you can use that function. Also, if you want to evaluate that function just do deviceInfoRequest()
User contributions licensed under CC BY-SA 3.0