First commit

This commit is contained in:
2026-01-13 21:02:23 -06:00
commit 054f45b5bd
403 changed files with 44137 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { RouterModule } from '@angular/router';
import { VerifyPage } from './verify.page';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
RouterModule.forChild([
{
path: '',
component: VerifyPage
}
])
],
declarations: [VerifyPage]
})
export class verifyPageModule {}

View File

@@ -0,0 +1,15 @@
<ion-header>
<ion-toolbar color="primary">
<ion-buttons slot="start">
<ion-menu-button></ion-menu-button>
</ion-buttons>
<ion-title>Verificar Telefono</ion-title>
</ion-toolbar>
</ion-header>
<ion-content padding>
<form #form="ngForm" (ngSubmit)="verifyMe(form)" method="post">
<ion-button type="submit" expand="full" color="facebook">Verificame</ion-button>
</form>
<br><br>
<ion-button (click)="logout()" expand="full" color="light">Cerrar sesión</ion-button>
</ion-content>

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,35 @@
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
import { VerifyPage } from './verify.page';
describe('VerifyPage', () => {
let component: VerifyPage;
let fixture: ComponentFixture<VerifyPage>;
let listPage: HTMLElement;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ VerifyPage ],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
.compileComponents();
}));
beforeEach(async () => {
fixture = await TestBed.createComponent(VerifyPage);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
it('should have a list of 10 elements', () => {
verifyPage = fixture.nativeElement;
const items = verifyPage.querySelectorAll('ion-item');
expect(items.length).toEqual(10);
});
});

View File

@@ -0,0 +1,64 @@
import { Component, OnInit } from '@angular/core';
import { ModalController, LoadingController, NavController } from '@ionic/angular';
import { AuthService } from 'src/app/services/auth.service';
import { NgForm } from '@angular/forms';
import { AlertService } from 'src/app/services/alert.service';
import { OneSignal, OSNotificationPayload } from '@ionic-native/onesignal/ngx';
@Component({
selector: 'app-verify',
templateUrl: 'verify.page.html',
styleUrls: ['verify.page.scss']
})
export class VerifyPage implements OnInit {
phone_string: string = "phone";
private loading;
constructor(
private modalController: ModalController,
private authService: AuthService,
private navCtrl: NavController,
private alertService: AlertService,
private oneSignal: OneSignal,
private loadingCtrl: LoadingController,
) { }
ngOnInit() {
}
// VerifyMe abre la API de AccountKit, despues de verificar el numero, envia el numero
// de telefono al backend con la funcion this.authService.verifyUser, que se encuentra en
// auth.service.ts
verifyMe(form: NgForm) {
this.authService.verifyUser(this.phone_string).subscribe(
data => {
console.log(data);
this.authService.isVerified = true
this.navCtrl.navigateRoot('/dashboard')
},
error => {
console.log(error);
}
);
}
logout() {
this.loadingCtrl.create().then((overlay) => {
this.loading = overlay;
this.loading.present();
});
this.authService.logout().subscribe(
data => {
this.alertService.presentToast("Sesión finalizada");
this.oneSignal.sendTag("iChamba_ID", null);
},
error => {
this.loading.dismiss();
console.log(error);
},
() => {
this.loading.dismiss();
this.navCtrl.navigateRoot('/landing');
}
);
}
}