Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilmysliwiec committed Mar 30, 2018
2 parents 14c7ea7 + 07869f3 commit 0b1f3ca
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/app/homepage/homepage.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { Router, NavigationEnd } from '@angular/router';
})
export class HomepageComponent implements OnInit, AfterViewInit {
isSidebarOpened = true;
previousWidth: number;

constructor(
private readonly cd: ChangeDetectorRef,
Expand All @@ -26,6 +27,7 @@ export class HomepageComponent implements OnInit, AfterViewInit {

ngOnInit(): void {
this.router.events.filter(e => e instanceof NavigationEnd).subscribe(() => {
this.previousWidth = window.innerWidth;
this.checkWindowWidth(window.innerWidth);
});
}
Expand All @@ -45,7 +47,8 @@ export class HomepageComponent implements OnInit, AfterViewInit {

checkWindowWidth(innerWidth?: number) {
innerWidth = innerWidth ? innerWidth : window.innerWidth;
if (innerWidth <= 768) {
if (this.previousWidth !== innerWidth && innerWidth <= 768) {
this.previousWidth = innerWidth;
this.isSidebarOpened = false;
this.cd.detectChanges();
}
Expand Down
4 changes: 2 additions & 2 deletions src/app/homepage/pages/recipes/passport/passport.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class AuthService {
return `
import * as passport from 'passport';
import { ExtractJwt, Strategy } from 'passport-jwt';
import { Component, Inject } from '@nestjs/common';
import { Component, Inject, UnauthorizedException } from '@nestjs/common';
import { AuthService } from '../auth.service';
@Component()
Expand All @@ -86,7 +86,7 @@ export class JwtStrategy extends Strategy {
public async verify(req, payload, done) {
const isValid = await this.authService.validateUser(payload);
if (!isValid) {
return done('Unauthorized', false);
return done(new UnauthorizedException(), false);
}
done(null, payload);
}
Expand Down

0 comments on commit 0b1f3ca

Please sign in to comment.