Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Parse.User.allowCustomUserClass(true);
- export class User extends Parse.User {
- email: string;
- password: string;
- isAdmin: string;
- constructor() {
- super('_User');
- }
- doLogin(email: string, password: string) {
- Parse.User.logIn(email, password).then(object => {
- console.log(object);
- this.isAdmin = object.get('isAdmin');
- }).catch(console.error);
- }
- doSignUp(username: string, email: string, password: string) {
- return makeAnAdmin(email, password);
- }
- }
- Parse.Object.registerSubclass('User', User);
- const makeAnAdmin = async (email: string, password: string): Promise<User> => {
- return Parse.User.signUp(email, password,
- {
- email: email,
- isAdmin: false
- }
- );
- }
Add Comment
Please, Sign In to add comment