forked from gdgbari/2023-web-devfest
-
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.
- Loading branch information
Showing
6 changed files
with
137 additions
and
57 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,11 @@ | ||
import type { CheckTokenResponse, SignupResponse } from "../types/authentication"; | ||
|
||
export class AuthenticationApi { | ||
async checkToken(token: string): Promise<CheckTokenResponse> { | ||
return { status: true, errorMessage: null }; | ||
} | ||
|
||
async signInWithEmailAndPassword(email: string, password: string): Promise<SignupResponse> { | ||
return { status: true, errorMessage: null }; | ||
} | ||
} |
Empty file.
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,25 @@ | ||
import { AuthenticationApi } from "../api/authentication_api"; | ||
import type { SignUpException } from "../types/authentication"; | ||
|
||
export class AuthenticationRepository { | ||
api: AuthenticationApi; | ||
|
||
constructor() { | ||
this.api = new AuthenticationApi(); | ||
} | ||
|
||
async checkToken(token: string): Promise<boolean> { | ||
const result = await this.api.checkToken(token); | ||
return result.status; | ||
} | ||
|
||
async signInWithEmailAndPassword(email: string, password: string): Promise<void> { | ||
const result = await this.api.signInWithEmailAndPassword(email, password); | ||
|
||
if (!result.status) { | ||
throw { | ||
message: result.errorMessage | ||
} as SignUpException; | ||
} | ||
} | ||
} |
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,13 @@ | ||
export type CheckTokenResponse = { | ||
status: boolean; | ||
errorMessage: string | null; | ||
} | ||
|
||
export type SignupResponse = { | ||
status: boolean; | ||
errorMessage: string | null; | ||
} | ||
|
||
export type SignUpException = { | ||
message: string; | ||
} |
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