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
import { AddPrefixComponent } from './components/add-prefix/add-prefix.component';*/
const routes: Routes = [
{ path: ' ', redirectTo: 'login', pathMatch: 'full' },
{ path: '', redirectTo: 'login', pathMatch: 'full' },
{ path: 'login', component: LoginComponent },
{ path: 'signup', component: SignupComponent },
{ path: 'boilerplates', component: BoilerplateListComponent, canActivate: [AuthGuard] },
......
......@@ -60,7 +60,6 @@
<button class="btn btn-success" routerLink="/add-boilerplate">Add</button>
</div>-->
</div>
<table mat-table [dataSource]="dataSource" class="mat-elevation-z8">
<!-- Position Column -->
......
......@@ -26,7 +26,7 @@ export class BoilerplateListComponent implements OnInit {
currentIndex = -1;
title = '';
displayedColumns: string[] = ['id', 'title', 'has_prefix', 'has_main', 'has_suffix'];
dataSource = ELEMENT_DATA;
dataSource = [{}]; //ELEMENT_DATA;
constructor(private boilerplateService: BoilerplateService) { }
......@@ -35,6 +35,7 @@ export class BoilerplateListComponent implements OnInit {
}
retrieveBoilerplates(): void {
this.dataSource = [{}];
this.boilerplateService.getAll()
.subscribe(
data => {
......
......@@ -38,7 +38,9 @@ export class AuthService {
this.apiRoot.concat('login/'),
{ email, password }
).pipe(
tap(response => this.setSession(response)),
tap(response => this.setSession(response)),
tap(response => console.log(response)),
shareReplay(),
);
}
......@@ -99,7 +101,7 @@ export class AuthInterceptor implements HttpInterceptor {
if (token) {
const cloned = req.clone({
headers: req.headers.set('Authorization', 'JWT '.concat(token))
headers: req.headers.set('Authorization', 'Bearer '.concat(token))
});
return next.handle(cloned);
......
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { HttpHeaders } from '@angular/common/http';
import { Observable } from 'rxjs';
import { Boilerplate } from '../models/boilerplate.model';
......
......@@ -46,8 +46,8 @@ INSTALLED_APPS = [
"django.contrib.staticfiles",
# 3rd party apps
"rest_framework",
'corsheaders',
'rest_framework_jwt.blacklist',
"corsheaders",
"rest_framework_jwt.blacklist",
# our apps
"reqman.apps.common.apps.CommonConfig",
"reqman.apps.account.apps.AccountConfig",
......@@ -55,7 +55,7 @@ INSTALLED_APPS = [
] + env.list("REQMAN_DEV_INSTALLED_APPS", default=[])
MIDDLEWARE = [
'corsheaders.middleware.CorsMiddleware',
"corsheaders.middleware.CorsMiddleware",
"django.middleware.security.SecurityMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.common.CommonMiddleware",
......@@ -154,12 +154,12 @@ JWT_AUTH = {
'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_ORIGIN_WHITELIST = [
'http://155.207.131.19:8081',
] # If this is used, then not need to use `CORS_ORIGIN_ALLOW_ALL = True`
#CORS_ORIGIN_REGEX_WHITELIST = [
# 'http://155.207.131.19:8081',
#]
CORS_ORIGIN_REGEX_WHITELIST = [
'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