Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions Resources/iphone/alloy/widgets/ds.slideMenu/controllers/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,25 +352,14 @@ function Controller() {
text: "All Events",
id: "__alloyId28"
});
<<<<<<< HEAD
$.__views.__alloyId7.add($.__views.__alloyId8);
$.__views.settingsBtn = Ti.UI.createButton({
=======
$.__views.__alloyId26.add($.__views.__alloyId28);
$.__views.__alloyId29 = Ti.UI.createView({
layout: "absolute",
>>>>>>> FETCH_HEAD
height: "7%",
right: 0,
width: "95%",
backgroundColor: "#424242",
top: "1%",
<<<<<<< HEAD
id: "settingsBtn"
});
$.__views.menuView.add($.__views.settingsBtn);
$.__views.__alloyId9 = Ti.UI.createLabel({
=======
id: "__alloyId29"
});
$.__views.menuView.add($.__views.__alloyId29);
Expand All @@ -383,7 +372,6 @@ function Controller() {
});
$.__views.__alloyId29.add($.__views.__alloyId30);
$.__views.__alloyId31 = Ti.UI.createLabel({
>>>>>>> FETCH_HEAD
width: Ti.UI.SIZE,
height: Ti.UI.SIZE,
color: "white",
Expand All @@ -396,11 +384,7 @@ function Controller() {
text: "Settings",
id: "__alloyId31"
});
<<<<<<< HEAD
$.__views.settingsBtn.add($.__views.__alloyId9);
=======
$.__views.__alloyId29.add($.__views.__alloyId31);
>>>>>>> FETCH_HEAD
$.__views.movableview = Ti.UI.createView({
top: 0,
left: 0,
Expand Down
8 changes: 8 additions & 0 deletions app/controllers/homeView.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
var args = arguments[0] || {};


var api = require('api');
api.user.login('test2@test.com', 'testtest', function(data){
console.log('got success', data);
}, function(){
console.log('got error', arguments);
});


function openMenu() {
Alloy.createController("menu").getView().open();
}
Expand Down
43 changes: 43 additions & 0 deletions app/lib/api.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
//IIFE

console.log('loading');

//Include the XHR wrapper which makes requests painless.
var XHR = require('xhr');

//Create a new XHR object.
var xhr = new XHR();

var endpoint = 'http://ourchive.elasticbeanstalk.com/api/v1/';

//User API Methods
var user = {
login: function(email, password, successCB, errorCB){
request('post', 'user/login', {username: email, password: password}, successCB, errorCB);
}
};

//Universal request function which
function request(method, url, data, successCB, errorCB){
if(method.toLowerCase() === 'post'){
xhr.post(endpoint + url, createApiData(data), successCB, errorCB);
}
if(method.toLowerCase() === 'get'){
xhr.get(endpoint + url, successCB, errorCB);
}
};

//Used to inject information into the API requests:
function createApiData(data){
data._apiRequest = true;
data._token = 'this+would+be+the+token';
return data;
};

//Create the exported object:
module.exports = {
user: user,
//Give the API raw access to the API request:
request: request
};

Loading