Commit 9175dc13 authored by Cédric Moreau's avatar Cédric Moreau

Connect

parent de696532
......@@ -27,7 +27,7 @@
<ion-icon name="person" item-left></ion-icon>
<span>Mon compte</span>
</ion-item-divider>
<button *ngIf="!_loginService.estIdentifie" ion-item (click)="_loginService.showPrompt()">
<button *ngIf="!_loginService.estIdentifie" ion-item routerLink="/connect">
S'identifier
</button>
<ng-container *ngIf="_loginService.estIdentifie">
......
......@@ -26,6 +26,7 @@ import {AnnouncePage} from "../pages/announce/announce";
import {AuthService} from "../services/auth-service";
import {AuthModal} from "../components/auth_modal/auth_modal";
import {AccountPage} from "../pages/account/account";
import {ConnectPage} from "../pages/connect/connect";
const appRoutes: Routes = [
{
......@@ -33,6 +34,10 @@ const appRoutes: Routes = [
component: HomePage,
data: { title: 'Titre 1' }
},
{
path: 'connect',
component: ConnectPage
},
{
path: 'mon_compte',
component: ProfilPage,
......@@ -83,6 +88,7 @@ const appRoutes: Routes = [
AccountPage,
ImageModalPage,
AuthModal,
ConnectPage,
ImageCropperComponent,
ItemDetailsPage,
ListPage
......
<ion-content padding>
<ion-row>
<ion-col col-12>
<p *ngIf="accountService.acc.pub == loginService.pub">
<button ion-button [routerLink]="['/account/edit', accountService.acc.pub]">Modifier votre fiche</button>
</p>
</ion-col>
</ion-row>
</ion-content>
connect {
.logo {
float: left;
max-width: 100px;
margin-top: 1.8rem;
padding-right: 15px;
}
}
import {Component, OnInit} from "@angular/core";
import {AccountService} from "../../services/account-service";
import {LoginService} from "../../services/login-service";
import {ActivatedRoute} from "@angular/router";
import {AnnounceService} from "../../services/announce-service";
@Component({
selector: 'connect',
template: require('../../app/topbar.html') + require('./connect.html')
})
export class ConnectPage implements OnInit {
title:string = "Se connecter"
announces:any
constructor(
private route: ActivatedRoute,
public loginService:LoginService,
public accountService:AccountService,
public announceService:AnnounceService) {
if (this.route.snapshot.data.creation) {
this.accountService.beginCreation(loginService.pub)
} else {
this.accountService.clean()
}
}
ngOnInit() {
this.route.params.subscribe(params => {
if (params['pub']) {
return this.accountService.getAccountInfos(params['pub'])
.then(res => this.accountService.acc = res.acc)
.then(() => {
return this.announceService.myAnnounces(this.accountService.acc.pub)
})
.then(res => {
this.announces = []
for (const a of res.announces) {
if (parseInt(a.stock)) {
if (a.images.length) {
a.thumbnail = a.images[0]
}
this.announces.push(a)
}
}
})
}
});
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment