react-native-meteor
Advanced tools
Comparing version 0.3.0 to 0.3.1
18
index.js
@@ -10,2 +10,4 @@ var DDP = require("ddp.js"); | ||
loginWithEmailCb; | ||
var loginWithUsernameId, | ||
loginWithUsernameCb; | ||
var loginWithTokenId, | ||
@@ -22,2 +24,11 @@ loginWithTokenCb; | ||
}, | ||
loginWithUsername: function (username, password, callback) { | ||
loginWithUsernameCb = callback; | ||
loginWithUsernameId = ddp.method("login", [{ | ||
user: { | ||
username: username | ||
}, | ||
password: password | ||
}]); | ||
}, | ||
loginWithEmail: function (email, password, callback) { | ||
@@ -125,2 +136,9 @@ loginWithEmailCb = callback; | ||
} | ||
if (message.id === loginWithUsernameId && typeof loginWithUsernameCb == 'function') { | ||
if(message.error) { | ||
return loginWithUsernameCb(message.error); | ||
} | ||
loginWithUsernameCb(null, message.result); | ||
return; | ||
} | ||
if (message.id === loginWithTokenId && typeof loginWithTokenCb == 'function') { | ||
@@ -127,0 +145,0 @@ if(message.error) { |
{ | ||
"name": "react-native-meteor", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "DDP React-native Client", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -154,2 +154,12 @@ [](https://badge.fury.io/gh/inProgress-team%2Freact-native-meteor) | ||
### loginWithUsername(username, password, callback) | ||
Login to meteor server | ||
#### Arguments | ||
- `username` **string** *required* | ||
- `password` **string** *required* | ||
- `callback(err, result)` **method** | ||
### loginWithToken(token, callback) | ||
@@ -156,0 +166,0 @@ |
14233
240
176