Fixed Leaderboards api and added to routing

This commit is contained in:
piratefinn 2017-06-19 12:41:08 +01:00
parent d63a2f5e30
commit 7c55779a0f
5 changed files with 18 additions and 3 deletions

View file

@ -1,6 +1,7 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router'; import { Routes, RouterModule } from '@angular/router';
import { LeaderboardsComponent } from './leaderboards.component';
import { ButtonsComponent } from './buttons.component'; import { ButtonsComponent } from './buttons.component';
import { CardsComponent } from './cards.component'; import { CardsComponent } from './cards.component';
import { FormsComponent } from './forms.component'; import { FormsComponent } from './forms.component';
@ -17,6 +18,13 @@ const routes: Routes = [
title: 'Components' title: 'Components'
}, },
children: [ children: [
{
path: 'leaderboards',
component: LeaderboardsComponent,
data: {
title: 'Leaderboards'
}
},
{ {
path: 'buttons', path: 'buttons',
component: ButtonsComponent, component: ButtonsComponent,

View file

@ -1,5 +1,9 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
// Pagesto be used in Production
import { LeaderboardsComponent } from './leaderboards.component';
// Buttons Component
import { ButtonsComponent } from './buttons.component'; import { ButtonsComponent } from './buttons.component';
import { CardsComponent } from './cards.component'; import { CardsComponent } from './cards.component';
@ -30,6 +34,7 @@ import { ComponentsRoutingModule } from './components-routing.module';
TabsModule TabsModule
], ],
declarations: [ declarations: [
LeaderboardsComponent,
ButtonsComponent, ButtonsComponent,
CardsComponent, CardsComponent,
FormsComponent, FormsComponent,

View file

@ -1,4 +1,4 @@
import { Component } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { Http, Response } from '@angular/http'; import { Http, Response } from '@angular/http';
import { ApiService } from '../providers/api-service'; import { ApiService } from '../providers/api-service';
import 'rxjs/add/operator/map'; import 'rxjs/add/operator/map';
@ -11,7 +11,6 @@ export class LeaderboardsComponent {
constructor( constructor(
private http: Http, private http: Http,
private formBuilder: FormBuilder,
private api: ApiService, private api: ApiService,
) { ) {
} }

View file

@ -61,6 +61,9 @@
<li class="nav-item nav-dropdown" routerLinkActive="open" appNavDropdown> <li class="nav-item nav-dropdown" routerLinkActive="open" appNavDropdown>
<a class="nav-link nav-dropdown-toggle" href="#" appNavDropdownToggle><i class="icon-puzzle"></i> Components</a> <a class="nav-link nav-dropdown-toggle" href="#" appNavDropdownToggle><i class="icon-puzzle"></i> Components</a>
<ul class="nav-dropdown-items"> <ul class="nav-dropdown-items">
<li class="nav-item">
<a class="nav-link" routerLinkActive="active" [routerLink]="['/components/leaderboards']"><i class="icon-puzzle"></i> Leaderboards</a>
</li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" routerLinkActive="active" [routerLink]="['/components/buttons']"><i class="icon-puzzle"></i> Buttons</a> <a class="nav-link" routerLinkActive="active" [routerLink]="['/components/buttons']"><i class="icon-puzzle"></i> Buttons</a>
</li> </li>

View file

@ -75,7 +75,7 @@ export class ApiService {
// Leaderboard Api // Leaderboard Api
public leaderboard_fetch(data) { public leaderboard_fetch(data) {
this.http.post( return this.http.post(
this.apiUrl + '/stats/leaderboard', this.apiUrl + '/stats/leaderboard',
{ {
session_key : this.sessionKey, session_key : this.sessionKey,