changed page names for automatic routing

This commit is contained in:
Ryan Bakkes 2022-01-04 04:09:19 +01:00
parent b7fdeddc9c
commit adbe142ffc
9 changed files with 28 additions and 24 deletions

View File

@ -11,8 +11,8 @@ const routes: Routes = [
loadChildren: () => import('./beliefs/beliefs.module').then( m => m.BeliefsPageModule) loadChildren: () => import('./beliefs/beliefs.module').then( m => m.BeliefsPageModule)
}, },
{ {
path: 'values', path: 'valuesSorting',
loadChildren: () => import('./values/values.module').then( m => m.ValuesPageModule) loadChildren: () => import('./valuesSorting/valuesSorting.module').then( m => m.ValuesSortingPageModule)
}, },
{ {
path: 'valuesAlign', path: 'valuesAlign',

View File

@ -76,8 +76,10 @@ export class ModalsGamePage {
break; break;
case "Values": case "Values":
await this.game.initValuesGame(); const status = await this.game.initValuesGame();
break; console.log(`/${game.toLowerCase()}${status}`);
this.router.navigateByUrl(`/${game.toLowerCase()}${status}`);
return;
} }
// routing is in lowercase, set text to lower // routing is in lowercase, set text to lower

View File

@ -43,7 +43,7 @@ export class GameService {
// if (data["Status"] == "Success") { // if (data["Status"] == "Success") {
// console.log(data["Data"]); // console.log(data["Data"]);
await this.storage.set(`${game.toUpperCase()}GAME_TOKEN`, { status: "sorting", cards:[{"title":"Temp_card_1"}, {"title":"Temp_card_2"}, {"title":"Temp_card_3"}, {"title":"Temp_card_4"}, {"title":"Temp_card_5"}, {"title":"Temp_card_6"}, {"title":"Temp_card_7"}, {"title":"Temp_card_8"}]}); await this.storage.set(`${game.toUpperCase()}GAME_TOKEN`, { status: "Sorting", cards:[{"title":"Temp_card_1"}, {"title":"Temp_card_2"}, {"title":"Temp_card_3"}, {"title":"Temp_card_4"}, {"title":"Temp_card_5"}, {"title":"Temp_card_6"}, {"title":"Temp_card_7"}, {"title":"Temp_card_8"}]});
// } // }
// return data; // return data;
// }), // }),
@ -53,8 +53,10 @@ export class GameService {
public async initValuesGame(){ public async initValuesGame(){
console.log("[GameService] Initializing Value game..."); console.log("[GameService] Initializing Value game...");
this.cardset = await this.storage.get("VALUESGAME_TOKEN"); const token = await this.storage.get("VALUESGAME_TOKEN");
console.log(this.cardset["cards"]); // console.log(this.cardset["cards"]);
this.cardset = this.cardset["cards"]; this.cardset = token["cards"];
return token["status"];
} }
} }

View File

@ -1,11 +1,11 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router'; import { RouterModule, Routes } from '@angular/router';
import { ValuesPage } from './values.page'; import { ValuesSortingPage } from './valuesSorting.page';
const routes: Routes = [ const routes: Routes = [
{ {
path: '', path: '',
component: ValuesPage, component: ValuesSortingPage,
} }
]; ];
@ -13,4 +13,4 @@ const routes: Routes = [
imports: [RouterModule.forChild(routes)], imports: [RouterModule.forChild(routes)],
exports: [RouterModule] exports: [RouterModule]
}) })
export class ValuesPageRoutingModule {} export class ValuesSortingPageRoutingModule {}

View File

@ -2,9 +2,9 @@ import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { IonicModule } from '@ionic/angular'; import { IonicModule } from '@ionic/angular';
import { FormsModule } from '@angular/forms'; import { FormsModule } from '@angular/forms';
import { ValuesPage } from './values.page'; import { ValuesSortingPage } from './valuesSorting.page';
import { ValuesPageRoutingModule } from './values-routing.module'; import { ValuesSortingPageRoutingModule } from './valuesSorting-routing.module';
@NgModule({ @NgModule({
@ -12,8 +12,8 @@ import { ValuesPageRoutingModule } from './values-routing.module';
CommonModule, CommonModule,
FormsModule, FormsModule,
IonicModule, IonicModule,
ValuesPageRoutingModule ValuesSortingPageRoutingModule
], ],
declarations: [ValuesPage] declarations: [ValuesSortingPage]
}) })
export class ValuesPageModule {} export class ValuesSortingPageModule {}

View File

@ -1,19 +1,19 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular'; import { IonicModule } from '@ionic/angular';
import { ValuesPage } from './values.page'; import { ValuesSortingPage } from './valuesSorting.page';
describe('HomePage', () => { describe('HomePage', () => {
let component: ValuesPage; let component: ValuesSortingPage;
let fixture: ComponentFixture<ValuesPage>; let fixture: ComponentFixture<ValuesSortingPage>;
beforeEach(waitForAsync(() => { beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [ ValuesPage ], declarations: [ ValuesSortingPage ],
imports: [IonicModule.forRoot()] imports: [IonicModule.forRoot()]
}).compileComponents(); }).compileComponents();
fixture = TestBed.createComponent(ValuesPage); fixture = TestBed.createComponent(ValuesSortingPage);
component = fixture.componentInstance; component = fixture.componentInstance;
fixture.detectChanges(); fixture.detectChanges();
})); }));

View File

@ -6,10 +6,10 @@ import { GameService } from '../services/game.service';
@Component({ @Component({
selector: 'app-home', selector: 'app-home',
templateUrl: 'values.page.html', templateUrl: 'valuesSorting.page.html',
styleUrls: ['values.page.scss'], styleUrls: ['valuesSorting.page.scss'],
}) })
export class ValuesPage { export class ValuesSortingPage {
@ViewChildren('card') cards: QueryList<ElementRef>; @ViewChildren('card') cards: QueryList<ElementRef>;
cardsArray: Array<ElementRef>; cardsArray: Array<ElementRef>;