Commit 04fa07be authored by Thodoris Nestoridis's avatar Thodoris Nestoridis

add boilerplate works!

parent ecc30837
...@@ -15,7 +15,7 @@ import { PrefixDetailsComponent } from './components/prefix-details/prefix-detai ...@@ -15,7 +15,7 @@ import { PrefixDetailsComponent } from './components/prefix-details/prefix-detai
import { AddPrefixComponent } from './components/add-prefix/add-prefix.component';*/ import { AddPrefixComponent } from './components/add-prefix/add-prefix.component';*/
const routes: Routes = [ const routes: Routes = [
{ path: ' ', redirectTo: 'login', pathMatch: 'full' }, { path: '', redirectTo: 'login', pathMatch: 'full' },
{ path: 'login', component: LoginComponent }, { path: 'login', component: LoginComponent },
{ path: 'signup', component: SignupComponent }, { path: 'signup', component: SignupComponent },
{ path: 'boilerplates', component: BoilerplateListComponent, canActivate: [AuthGuard] }, { path: 'boilerplates', component: BoilerplateListComponent, canActivate: [AuthGuard] },
......
...@@ -60,7 +60,6 @@ ...@@ -60,7 +60,6 @@
<button class="btn btn-success" routerLink="/add-boilerplate">Add</button> <button class="btn btn-success" routerLink="/add-boilerplate">Add</button>
</div>--> </div>-->
</div> </div>
<table mat-table [dataSource]="dataSource" class="mat-elevation-z8"> <table mat-table [dataSource]="dataSource" class="mat-elevation-z8">
<!-- Position Column --> <!-- Position Column -->
......
...@@ -26,7 +26,7 @@ export class BoilerplateListComponent implements OnInit { ...@@ -26,7 +26,7 @@ export class BoilerplateListComponent implements OnInit {
currentIndex = -1; currentIndex = -1;
title = ''; title = '';
displayedColumns: string[] = ['id', 'title', 'has_prefix', 'has_main', 'has_suffix']; displayedColumns: string[] = ['id', 'title', 'has_prefix', 'has_main', 'has_suffix'];
dataSource = ELEMENT_DATA; dataSource = [{}]; //ELEMENT_DATA;
constructor(private boilerplateService: BoilerplateService) { } constructor(private boilerplateService: BoilerplateService) { }
...@@ -35,6 +35,7 @@ export class BoilerplateListComponent implements OnInit { ...@@ -35,6 +35,7 @@ export class BoilerplateListComponent implements OnInit {
} }
retrieveBoilerplates(): void { retrieveBoilerplates(): void {
this.dataSource = [{}];
this.boilerplateService.getAll() this.boilerplateService.getAll()
.subscribe( .subscribe(
data => { data => {
......
...@@ -39,6 +39,8 @@ export class AuthService { ...@@ -39,6 +39,8 @@ export class AuthService {
{ email, password } { email, password }
).pipe( ).pipe(
tap(response => this.setSession(response)), tap(response => this.setSession(response)),
tap(response => console.log(response)),
shareReplay(), shareReplay(),
); );
} }
...@@ -99,7 +101,7 @@ export class AuthInterceptor implements HttpInterceptor { ...@@ -99,7 +101,7 @@ export class AuthInterceptor implements HttpInterceptor {
if (token) { if (token) {
const cloned = req.clone({ const cloned = req.clone({
headers: req.headers.set('Authorization', 'JWT '.concat(token)) headers: req.headers.set('Authorization', 'Bearer '.concat(token))
}); });
return next.handle(cloned); return next.handle(cloned);
......
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
import { HttpHeaders } from '@angular/common/http';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { Boilerplate } from '../models/boilerplate.model'; import { Boilerplate } from '../models/boilerplate.model';
......
...@@ -46,8 +46,8 @@ INSTALLED_APPS = [ ...@@ -46,8 +46,8 @@ INSTALLED_APPS = [
"django.contrib.staticfiles", "django.contrib.staticfiles",
# 3rd party apps # 3rd party apps
"rest_framework", "rest_framework",
'corsheaders', "corsheaders",
'rest_framework_jwt.blacklist', "rest_framework_jwt.blacklist",
# our apps # our apps
"reqman.apps.common.apps.CommonConfig", "reqman.apps.common.apps.CommonConfig",
"reqman.apps.account.apps.AccountConfig", "reqman.apps.account.apps.AccountConfig",
...@@ -55,7 +55,7 @@ INSTALLED_APPS = [ ...@@ -55,7 +55,7 @@ INSTALLED_APPS = [
] + env.list("REQMAN_DEV_INSTALLED_APPS", default=[]) ] + env.list("REQMAN_DEV_INSTALLED_APPS", default=[])
MIDDLEWARE = [ MIDDLEWARE = [
'corsheaders.middleware.CorsMiddleware', "corsheaders.middleware.CorsMiddleware",
"django.middleware.security.SecurityMiddleware", "django.middleware.security.SecurityMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware", "django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.common.CommonMiddleware", "django.middleware.common.CommonMiddleware",
...@@ -154,12 +154,12 @@ JWT_AUTH = { ...@@ -154,12 +154,12 @@ JWT_AUTH = {
'JWT_EXPIRATION_DELTA': timedelta(days=2), 'JWT_EXPIRATION_DELTA': timedelta(days=2),
} }
CORS_ORIGIN_ALLOW_ALL = True # If this is used then `CORS_ORIGIN_WHITELIST` will not have any effect CORS_ORIGIN_ALLOW_ALL = False # If this is used then `CORS_ORIGIN_WHITELIST` will not have any effect
CORS_ALLOW_CREDENTIALS = True CORS_ALLOW_CREDENTIALS = True
CORS_ORIGIN_WHITELIST = [ CORS_ORIGIN_WHITELIST = [
'http://155.207.131.19:8081', 'http://155.207.131.19:8081',
] # If this is used, then not need to use `CORS_ORIGIN_ALLOW_ALL = True` ] # If this is used, then not need to use `CORS_ORIGIN_ALLOW_ALL = True`
#CORS_ORIGIN_REGEX_WHITELIST = [ CORS_ORIGIN_REGEX_WHITELIST = [
# 'http://155.207.131.19:8081', 'http://155.207.131.19:8081',
#] ]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment