Skip to content
This repository has been archived by the owner on Oct 14, 2022. It is now read-only.

Commit

Permalink
Merge pull request #6 from futureleadersupc/feat/auth-service
Browse files Browse the repository at this point in the history
feat(auth): added initial auth service
  • Loading branch information
gakol28 authored May 7, 2022
2 parents 3b33287 + d320dc4 commit ea44ec8
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/app/auth/model/user.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export interface User {
preferredName: string;
fullName: string;
email: string;
location: string;
profileViews: number;
biography: string;
about: string;
}
16 changes: 16 additions & 0 deletions src/app/auth/services/auth.service.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { TestBed } from "@angular/core/testing";

import { AuthService } from "./auth.service";

describe("AuthService", () => {
let service: AuthService;

beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(AuthService);
});

it("should be created", () => {
expect(service).toBeTruthy();
});
});
37 changes: 37 additions & 0 deletions src/app/auth/services/auth.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { User } from "../model/user";
import { Injectable } from "@angular/core";

@Injectable({
providedIn: "root",
})
export class AuthService {
static user: User = {
preferredName: "John",
fullName: "John Doe",
email: "john.doe@gmail.com",
location: "Lima, Peru",
profileViews: 367,
biography:
"Freelance UX/UI designer, 80+ projects in Web, Mobile (Android & iOS) and creative projects. Open to offers.",
about:
"I'm more experienced in e-commerce web projects and mobile banking apps, but also like to work with creative projects, such as landing pages or unusual corporate websites.",
};
static loggedIn: boolean = true;

constructor() {}

static login(): void {
this.loggedIn = true;
}

static logout(): void {
this.loggedIn = false;
}

static getCurrentUser(): User | null {
if (this.loggedIn) {
return this.user;
}
return null;
}
}

0 comments on commit ea44ec8

Please sign in to comment.