Here is my code...
'use strict';
var React = require('react-native');
var {
AsyncStorage
} = React;
exports.buildUrl = function(){
var test = new Sales();
test.getOrder();
}
class queryBuilder{
constructor() {
}
getUrl(){
AsyncStorage.getItem('auth').then((value) => {
var auth = JSON.parse(value);
var store = auth.url;
console.log('store = ' + store);
return store;
});
}
}
class Sales extends queryBuilder{
async getOrder(){
console.log('get order hit');
try{
var urlstart = await this.getUrl();
} catch(e) {
console.log('ERROR')
console.log(e);
}
console.log('URL BELOW');
console.log(urlstart);
console.log('URL ABOVE');
}
}
In my getOrder
method I was hoping that urlstart
would not be undefined
because i have used await.
The console.log
within getUrl()
method is the last thing to return in my console.
Maybe it's that saturday feeling, any help much appreciated!