Guest User

Untitled

a guest
Jan 24th, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. Parse.User.allowCustomUserClass(true);
  2.  
  3. export class User extends Parse.User {
  4. email: string;
  5. password: string;
  6. isAdmin: string;
  7.  
  8. constructor() {
  9. super('_User');
  10. }
  11.  
  12. doLogin(email: string, password: string) {
  13. Parse.User.logIn(email, password).then(object => {
  14. console.log(object);
  15. this.isAdmin = object.get('isAdmin');
  16. }).catch(console.error);
  17. }
  18.  
  19. doSignUp(username: string, email: string, password: string) {
  20. return makeAnAdmin(email, password);
  21. }
  22.  
  23. }
  24.  
  25. Parse.Object.registerSubclass('User', User);
  26.  
  27. const makeAnAdmin = async (email: string, password: string): Promise<User> => {
  28. return Parse.User.signUp(email, password,
  29. {
  30. email: email,
  31. isAdmin: false
  32. }
  33. );
  34. }
Add Comment
Please, Sign In to add comment