Skip to content

Commit

Permalink
Fix merge request
Browse files Browse the repository at this point in the history
  • Loading branch information
Théo mathieu committed Mar 19, 2016
1 parent a454f1f commit a40fd43
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 23 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ Disconnect from the DDP server.
* [Meteor.loginWithPassword](http://docs.meteor.com/#/full/meteor_loginwithpassword) (Please note that user is auto-resigned in - like in Meteor Web applications - thanks to React Native AsyncStorage.)
* [Meteor.logout](http://docs.meteor.com/#/full/meteor_logout)
* [Meteor.call](http://docs.meteor.com/#/full/meteor_call)

## Meteor.Accounts

* [Accounts.createUser](http://docs.meteor.com/#/full/accounts_createuser)

## Meteor.ddp
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-meteor",
"version": "1.0.0-beta13",
"version": "1.0.0-beta14",
"description": "DDP React-native Client",
"main": "src/Meteor.js",
"scripts": {
Expand Down
9 changes: 5 additions & 4 deletions src/Accounts.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import call from './Call';
import User from './User';
import Meteor from './Meteor';
import { hashPassword } from '../utils';
import { hashPassword } from '../lib/utils';

export default {

module.exports = {
createUser(options, callback) {
if (options.username) options.username = options.username;
if (options.email) options.email = options.email;
Expand All @@ -11,7 +12,7 @@ export default {
options.password = hashPassword(options.password);

User._startLoggingIn();
Meteor.call("createUser", options, (err, result)=>{
call("createUser", options, (err, result)=>{
User._endLoggingIn();

User._handleLoginCallback(err, result);
Expand Down
15 changes: 15 additions & 0 deletions src/Call.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import Data from './Data';

export default function(eventName) {
var args = Array.prototype.slice.call(arguments, 1);
if (args.length && typeof args[args.length - 1] === "function") {
var callback = args.pop();
}


const id = Data.ddp.method(eventName, args);
Data.calls.push({
id: id,
callback: callback
});
}
22 changes: 5 additions & 17 deletions src/Meteor.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import Mixin from './Mixin';
import User from './User';
import ListView from './ListView';
import collection from './Collection';
import Accounts from './Accounts';
import call from './Call';


export Accounts from './Accounts';

export default {
module.exports = {
Accounts: Accounts,
MeteorListView: ListView,
collection: collection,
getData() {
Expand All @@ -34,19 +34,7 @@ export default {
//reason:
}
},
call(eventName) {
var args = Array.prototype.slice.call(arguments, 1);
if (args.length && typeof args[args.length - 1] === "function") {
var callback = args.pop();
}


const id = Data.ddp.method(eventName, args);
Data.calls.push({
id: id,
callback: callback
});
},
call: call,
disconnect() {
if(Data.ddp) {
Data.ddp.disconnect();
Expand Down
2 changes: 1 addition & 1 deletion src/User.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { AsyncStorage } from 'react-native';

import Data from './Data';
import { hashPassword } from '../utils';
import { hashPassword } from '../lib/utils';

const TOKEN_KEY = 'reactnativemeteor_usertoken';

Expand Down

0 comments on commit a40fd43

Please sign in to comment.