Skip to content
Snippets Groups Projects
Commit 15aef317 authored by Danial Hezarkhani's avatar Danial Hezarkhani
Browse files

brough changes from master

parents fe01c278 90d9d7ea
No related branches found
No related tags found
No related merge requests found
Showing
with 205 additions and 0 deletions
<p>catalog works!</p>
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { CatalogComponent } from './catalog.component';
describe('CatalogComponent', () => {
let component: CatalogComponent;
let fixture: ComponentFixture<CatalogComponent>;
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [CatalogComponent]
});
fixture = TestBed.createComponent(CatalogComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component } from '@angular/core';
@Component({
selector: 'app-catalog',
templateUrl: './catalog.component.html',
styleUrls: ['./catalog.component.scss']
})
export class CatalogComponent {
}
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { CatalogComponent } from './catalog.component';
import { CatalogRoutingModule } from './catalog-routing.module';
@NgModule({
declarations: [
CatalogComponent
],
imports: [
CommonModule,
CatalogRoutingModule
]
})
export class CatalogModule { }
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { HomeComponent } from './home.component';
const routes: Routes = [
{
path: '',
component: HomeComponent
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class HomeRoutingModule { }
<p>home works nicellley!</p>
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { HomeComponent } from './home.component';
describe('HomeComponent', () => {
let component: HomeComponent;
let fixture: ComponentFixture<HomeComponent>;
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [HomeComponent]
});
fixture = TestBed.createComponent(HomeComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component } from '@angular/core';
@Component({
selector: 'app-home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.scss']
})
export class HomeComponent {
}
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { HomeComponent } from './home.component';
import { HomeRoutingModule } from './home-routing.module';
@NgModule({
declarations: [
HomeComponent
],
imports: [
CommonModule,
HomeRoutingModule
]
})
export class HomeModule { }
<div style="background-color: #ccc">
<h1>{{title}}</h1>
</div>
\ No newline at end of file
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { HeaderComponent } from './header.component';
describe('HeaderComponent', () => {
let component: HeaderComponent;
let fixture: ComponentFixture<HeaderComponent>;
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [HeaderComponent]
});
fixture = TestBed.createComponent(HeaderComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, Input } from '@angular/core';
@Component({
selector: 'app-header',
templateUrl: './header.component.html',
styleUrls: ['./header.component.scss']
})
export class HeaderComponent {
@Input() title!: string;
}
import { TestBed } from '@angular/core/testing';
import { HttpInterceptorService } from './http-interceptor.service';
describe('HttpInterceptorService', () => {
let service: HttpInterceptorService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(HttpInterceptorService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
import { Injectable } from '@angular/core';
import {
HttpErrorResponse, HttpEvent, HttpHandler, HttpInterceptor,
HttpRequest,
HttpResponse
} from '@angular/common/http';
import { Observable } from 'rxjs';
import { environment } from 'src/environment/environment';
import { apiConfig } from 'src/app/config/api-config';
@Injectable({
providedIn: 'root'
})
export class HttpInterceptorService implements HttpInterceptor{
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
// if the system is not in production, change the bearer for each http request
if (!environment.production) {
const modifiedReq = req.clone({
headers: req.headers.set('Authorization', `Bearer ${apiConfig.token}`),
});
return next.handle(modifiedReq);
}
// if there is nothing to intercept, pass the request.
return next.handle(req);
}
}
export const environment = {
// local with session
production: false,
baseURL: 'http://localhost:8888/',
backendURL: "",
isDebugMode: true
}
\ No newline at end of file
src/favicon.ico

948 B

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment