mirror of
https://github.com/sensebox/blockly-app
synced 2025-07-01 17:00:25 +02:00
shows all boxes on after login
This commit is contained in:
parent
db4d2ffbd5
commit
bbe07dee10
5 changed files with 36 additions and 10 deletions
|
@ -18,7 +18,7 @@ export class LoginPage {
|
|||
userName: string;
|
||||
password: string;
|
||||
private token:string
|
||||
private user:ArrayBuffer=undefined;
|
||||
private boxes:Object;
|
||||
public loading=false;
|
||||
constructor(
|
||||
public navCtrl: NavController,
|
||||
|
@ -30,12 +30,12 @@ export class LoginPage {
|
|||
private async submitLogin(form){
|
||||
try {
|
||||
this.token = await this.loginProvider.login("e_thie10@uni-muenster.de","Qxpxtexb1")
|
||||
this.user = await this.loginProvider.getUser(this.token);
|
||||
this.boxes = await this.loginProvider.getUserBoxes(this.token);
|
||||
}
|
||||
catch(err){
|
||||
console.log(err.message)
|
||||
}
|
||||
this.navCtrl.push(MySenseBoxPage,this.user);
|
||||
this.navCtrl.push(MySenseBoxPage,this.boxes);
|
||||
}
|
||||
|
||||
ionViewDidLoad() {
|
||||
|
|
|
@ -11,8 +11,29 @@
|
|||
</ion-navbar>
|
||||
|
||||
</ion-header>
|
||||
|
||||
|
||||
<ion-content padding>
|
||||
|
||||
<ion-grid>
|
||||
<ion-row *ngFor="let box of boxes">
|
||||
<ion-card>
|
||||
<ion-card-header>
|
||||
<ion-card-title>
|
||||
{{box.name}}
|
||||
</ion-card-title>
|
||||
</ion-card-header>
|
||||
<ion-card-content>
|
||||
<ion-row>
|
||||
<ion-col col-4>
|
||||
<button class="actionButton" ion-button color="light">Show</button>
|
||||
</ion-col>
|
||||
<ion-col col-4>
|
||||
<button class="actionButton" ion-button color="light">Edit</button>
|
||||
</ion-col>
|
||||
<ion-col col-4>
|
||||
<button class="actionButton" ion-button color="light">Sketch</button>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
</ion-card-content>
|
||||
</ion-card>
|
||||
</ion-row>
|
||||
</ion-grid>
|
||||
</ion-content>
|
|
@ -1,3 +1,6 @@
|
|||
page-my-sense-box {
|
||||
|
||||
}
|
||||
.actionButton{
|
||||
width:100%
|
||||
}
|
|
@ -15,7 +15,7 @@ import {LoginProvider} from "../../providers/LoginProvider/LoginProvider";
|
|||
})
|
||||
export class MySenseBoxPage {
|
||||
token:string;
|
||||
private user: ArrayBuffer=undefined;
|
||||
public boxes:Array<any>;
|
||||
constructor(public navCtrl: NavController,
|
||||
public navParams: NavParams,
|
||||
private loginProvider: LoginProvider
|
||||
|
@ -24,6 +24,8 @@ export class MySenseBoxPage {
|
|||
|
||||
ionViewDidLoad() {
|
||||
console.log('ionViewDidLoad MySenseBoxPage');
|
||||
console.log(this.navParams) }
|
||||
this.boxes = this.navParams.data.data.boxes
|
||||
console.log(this.boxes);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ export class LoginProvider {
|
|||
});
|
||||
};
|
||||
|
||||
async getUser(token:string):Promise<ArrayBuffer>{
|
||||
async getUserBoxes(token:string):Promise<Object>{
|
||||
const headers = new HttpHeaders({'Authorization':"Bearer "+token})
|
||||
return this.http.get(URL_user,{headers})
|
||||
.pipe(timeout(30000))
|
||||
|
|
Loading…
Add table
Reference in a new issue