| @@ -1,16 +1,18 @@ | |||||
| import { NgModule } from '@angular/core'; | import { NgModule } from '@angular/core'; | ||||
| import { Routes, RouterModule } from '@angular/router'; | import { Routes, RouterModule } from '@angular/router'; | ||||
| import { LoginComponent } from './login/login.component'; | import { LoginComponent } from './login/login.component'; | ||||
| import { WidgetsHolderComponent } from './widgets-holder/widgets-holder.component'; | |||||
| const routes: Routes = [ | |||||
| { | |||||
| path: "", | |||||
| redirectTo: "/login", | |||||
| pathMatch: "full" | |||||
| }, | |||||
| { | |||||
| path: "login", | |||||
| const routes: Routes = [{ | |||||
| path: '', | |||||
| redirectTo: '/login', | |||||
| pathMatch: 'full' | |||||
| },{ | |||||
| path: 'login', | |||||
| component: LoginComponent | component: LoginComponent | ||||
| },{ | |||||
| path: 'shop-details', | |||||
| component: WidgetsHolderComponent | |||||
| }, | }, | ||||
| ]; | ]; | ||||
| @@ -1,4 +1,5 @@ | |||||
| import { Component } from '@angular/core'; | import { Component } from '@angular/core'; | ||||
| import { Router } from '@angular/router'; | |||||
| @Component({ | @Component({ | ||||
| selector: 'app-root', | selector: 'app-root', | ||||
| @@ -6,4 +7,11 @@ import { Component } from '@angular/core'; | |||||
| styleUrls: ['./app.component.scss'] | styleUrls: ['./app.component.scss'] | ||||
| }) | }) | ||||
| export class AppComponent { | export class AppComponent { | ||||
| constructor( | |||||
| public router: Router | |||||
| ) { | |||||
| if (localStorage.vendor_token) { | |||||
| this.router.navigate(['shop-details']); | |||||
| } | |||||
| } | |||||
| } | } | ||||
| @@ -4,11 +4,23 @@ import { NgModule } from '@angular/core'; | |||||
| import { AppRoutingModule } from './app-routing.module'; | import { AppRoutingModule } from './app-routing.module'; | ||||
| import { AppComponent } from './app.component'; | import { AppComponent } from './app.component'; | ||||
| import { LoginComponent } from './login/login.component'; | import { LoginComponent } from './login/login.component'; | ||||
| import { WidgetsHolderComponent } from './widgets-holder/widgets-holder.component'; | |||||
| import { DashboardComponent } from './dashboard/dashboard.component'; | |||||
| import { OrdersComponent } from './orders/orders.component'; | |||||
| import { MenuItemsComponent } from './menu-items/menu-items.component'; | |||||
| import { OffersComponent } from './offers/offers.component'; | |||||
| import { SchedulesComponent } from './schedules/schedules.component'; | |||||
| @NgModule({ | @NgModule({ | ||||
| declarations: [ | declarations: [ | ||||
| AppComponent, | AppComponent, | ||||
| LoginComponent | |||||
| LoginComponent, | |||||
| WidgetsHolderComponent, | |||||
| DashboardComponent, | |||||
| OrdersComponent, | |||||
| MenuItemsComponent, | |||||
| OffersComponent, | |||||
| SchedulesComponent | |||||
| ], | ], | ||||
| imports: [ | imports: [ | ||||
| BrowserModule, | BrowserModule, | ||||
| @@ -0,0 +1 @@ | |||||
| <p>dashboard works!</p> | |||||
| @@ -0,0 +1,25 @@ | |||||
| import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | |||||
| import { DashboardComponent } from './dashboard.component'; | |||||
| describe('DashboardComponent', () => { | |||||
| let component: DashboardComponent; | |||||
| let fixture: ComponentFixture<DashboardComponent>; | |||||
| beforeEach(async(() => { | |||||
| TestBed.configureTestingModule({ | |||||
| declarations: [ DashboardComponent ] | |||||
| }) | |||||
| .compileComponents(); | |||||
| })); | |||||
| beforeEach(() => { | |||||
| fixture = TestBed.createComponent(DashboardComponent); | |||||
| component = fixture.componentInstance; | |||||
| fixture.detectChanges(); | |||||
| }); | |||||
| it('should create', () => { | |||||
| expect(component).toBeTruthy(); | |||||
| }); | |||||
| }); | |||||
| @@ -0,0 +1,15 @@ | |||||
| import { Component, OnInit } from '@angular/core'; | |||||
| @Component({ | |||||
| selector: 'app-dashboard', | |||||
| templateUrl: './dashboard.component.html', | |||||
| styleUrls: ['./dashboard.component.scss'] | |||||
| }) | |||||
| export class DashboardComponent implements OnInit { | |||||
| constructor() { } | |||||
| ngOnInit() { | |||||
| } | |||||
| } | |||||
| @@ -16,7 +16,8 @@ export class LoginComponent implements OnInit { | |||||
| } | } | ||||
| authenticateUser() { | authenticateUser() { | ||||
| this.router.navigate(['login']); | |||||
| localStorage.vendor_token = 'a'; | |||||
| this.router.navigate(['shop-details']); | |||||
| } | } | ||||
| } | } | ||||
| @@ -0,0 +1 @@ | |||||
| <p>menu-items works!</p> | |||||
| @@ -0,0 +1,25 @@ | |||||
| import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | |||||
| import { MenuItemsComponent } from './menu-items.component'; | |||||
| describe('MenuItemsComponent', () => { | |||||
| let component: MenuItemsComponent; | |||||
| let fixture: ComponentFixture<MenuItemsComponent>; | |||||
| beforeEach(async(() => { | |||||
| TestBed.configureTestingModule({ | |||||
| declarations: [ MenuItemsComponent ] | |||||
| }) | |||||
| .compileComponents(); | |||||
| })); | |||||
| beforeEach(() => { | |||||
| fixture = TestBed.createComponent(MenuItemsComponent); | |||||
| component = fixture.componentInstance; | |||||
| fixture.detectChanges(); | |||||
| }); | |||||
| it('should create', () => { | |||||
| expect(component).toBeTruthy(); | |||||
| }); | |||||
| }); | |||||
| @@ -0,0 +1,15 @@ | |||||
| import { Component, OnInit } from '@angular/core'; | |||||
| @Component({ | |||||
| selector: 'app-menu-items', | |||||
| templateUrl: './menu-items.component.html', | |||||
| styleUrls: ['./menu-items.component.scss'] | |||||
| }) | |||||
| export class MenuItemsComponent implements OnInit { | |||||
| constructor() { } | |||||
| ngOnInit() { | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1 @@ | |||||
| <p>offers works!</p> | |||||
| @@ -0,0 +1,25 @@ | |||||
| import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | |||||
| import { OffersComponent } from './offers.component'; | |||||
| describe('OffersComponent', () => { | |||||
| let component: OffersComponent; | |||||
| let fixture: ComponentFixture<OffersComponent>; | |||||
| beforeEach(async(() => { | |||||
| TestBed.configureTestingModule({ | |||||
| declarations: [ OffersComponent ] | |||||
| }) | |||||
| .compileComponents(); | |||||
| })); | |||||
| beforeEach(() => { | |||||
| fixture = TestBed.createComponent(OffersComponent); | |||||
| component = fixture.componentInstance; | |||||
| fixture.detectChanges(); | |||||
| }); | |||||
| it('should create', () => { | |||||
| expect(component).toBeTruthy(); | |||||
| }); | |||||
| }); | |||||
| @@ -0,0 +1,15 @@ | |||||
| import { Component, OnInit } from '@angular/core'; | |||||
| @Component({ | |||||
| selector: 'app-offers', | |||||
| templateUrl: './offers.component.html', | |||||
| styleUrls: ['./offers.component.scss'] | |||||
| }) | |||||
| export class OffersComponent implements OnInit { | |||||
| constructor() { } | |||||
| ngOnInit() { | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1 @@ | |||||
| <p>orders works!</p> | |||||
| @@ -0,0 +1,25 @@ | |||||
| import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | |||||
| import { OrdersComponent } from './orders.component'; | |||||
| describe('OrdersComponent', () => { | |||||
| let component: OrdersComponent; | |||||
| let fixture: ComponentFixture<OrdersComponent>; | |||||
| beforeEach(async(() => { | |||||
| TestBed.configureTestingModule({ | |||||
| declarations: [ OrdersComponent ] | |||||
| }) | |||||
| .compileComponents(); | |||||
| })); | |||||
| beforeEach(() => { | |||||
| fixture = TestBed.createComponent(OrdersComponent); | |||||
| component = fixture.componentInstance; | |||||
| fixture.detectChanges(); | |||||
| }); | |||||
| it('should create', () => { | |||||
| expect(component).toBeTruthy(); | |||||
| }); | |||||
| }); | |||||
| @@ -0,0 +1,15 @@ | |||||
| import { Component, OnInit } from '@angular/core'; | |||||
| @Component({ | |||||
| selector: 'app-orders', | |||||
| templateUrl: './orders.component.html', | |||||
| styleUrls: ['./orders.component.scss'] | |||||
| }) | |||||
| export class OrdersComponent implements OnInit { | |||||
| constructor() { } | |||||
| ngOnInit() { | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1 @@ | |||||
| <p>schedules works!</p> | |||||
| @@ -0,0 +1,25 @@ | |||||
| import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | |||||
| import { SchedulesComponent } from './schedules.component'; | |||||
| describe('SchedulesComponent', () => { | |||||
| let component: SchedulesComponent; | |||||
| let fixture: ComponentFixture<SchedulesComponent>; | |||||
| beforeEach(async(() => { | |||||
| TestBed.configureTestingModule({ | |||||
| declarations: [ SchedulesComponent ] | |||||
| }) | |||||
| .compileComponents(); | |||||
| })); | |||||
| beforeEach(() => { | |||||
| fixture = TestBed.createComponent(SchedulesComponent); | |||||
| component = fixture.componentInstance; | |||||
| fixture.detectChanges(); | |||||
| }); | |||||
| it('should create', () => { | |||||
| expect(component).toBeTruthy(); | |||||
| }); | |||||
| }); | |||||
| @@ -0,0 +1,15 @@ | |||||
| import { Component, OnInit } from '@angular/core'; | |||||
| @Component({ | |||||
| selector: 'app-schedules', | |||||
| templateUrl: './schedules.component.html', | |||||
| styleUrls: ['./schedules.component.scss'] | |||||
| }) | |||||
| export class SchedulesComponent implements OnInit { | |||||
| constructor() { } | |||||
| ngOnInit() { | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,25 @@ | |||||
| import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | |||||
| import { WidgetsHolderComponent } from './widgets-holder.component'; | |||||
| describe('WidgetsHolderComponent', () => { | |||||
| let component: WidgetsHolderComponent; | |||||
| let fixture: ComponentFixture<WidgetsHolderComponent>; | |||||
| beforeEach(async(() => { | |||||
| TestBed.configureTestingModule({ | |||||
| declarations: [ WidgetsHolderComponent ] | |||||
| }) | |||||
| .compileComponents(); | |||||
| })); | |||||
| beforeEach(() => { | |||||
| fixture = TestBed.createComponent(WidgetsHolderComponent); | |||||
| component = fixture.componentInstance; | |||||
| fixture.detectChanges(); | |||||
| }); | |||||
| it('should create', () => { | |||||
| expect(component).toBeTruthy(); | |||||
| }); | |||||
| }); | |||||
| @@ -0,0 +1,15 @@ | |||||
| import { Component, OnInit } from '@angular/core'; | |||||
| @Component({ | |||||
| selector: 'app-widgets-holder', | |||||
| templateUrl: './widgets-holder.component.html', | |||||
| styleUrls: ['./widgets-holder.component.scss'] | |||||
| }) | |||||
| export class WidgetsHolderComponent implements OnInit { | |||||
| constructor() { } | |||||
| ngOnInit() { | |||||
| } | |||||
| } | |||||