-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
scaffold login redirect and auth service... need to setup httpInterce…
…ptor, guards, routes, login page, etc
- Loading branch information
1 parent
18d52f4
commit 709216c
Showing
5 changed files
with
97 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { HttpClient } from '@angular/common/http'; | ||
import { Injectable } from '@angular/core'; | ||
import { BehaviorSubject } from 'rxjs'; | ||
import { environment } from '../../environments/environment'; | ||
|
||
@Injectable({ | ||
providedIn: 'root', | ||
}) | ||
export class AuthService { | ||
private _isAuth = new BehaviorSubject<boolean>(false); | ||
isAuthenticated$ = this._isAuth.asObservable(); | ||
|
||
constructor(private http: HttpClient) {} | ||
|
||
initiateGithubAuth() { | ||
// Instead of making an HTTP request, redirect the browser | ||
window.location.href = environment.baseUrl + '/auth/github'; | ||
} | ||
|
||
// logout(): Observable<any> { | ||
// return this.http.post('/api/auth/logout', {}).pipe( | ||
// tap(() => { | ||
// this.isAuthenticatedSubject.next(false); | ||
// }), | ||
// ); | ||
// } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export const environment = { | ||
production: true, | ||
baseUrl: 'https://feined-server.s11a.com', | ||
}; |
4 changes: 2 additions & 2 deletions
4
src/enviroments/environment.ts → src/environments/environment.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export const enviroment = { | ||
export const environment = { | ||
baseUrl: 'http://localhost:8080', | ||
} | ||
}; |