-
Notifications
You must be signed in to change notification settings - Fork 2
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
11 changed files
with
621 additions
and
557 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
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,31 @@ | ||
import AuthRepository from '../../Domain/Auth/AuthRepository.ts' | ||
import { Session } from '../../Domain/Auth/Auth.ts' | ||
import InMemoryRepository from './InMemoryRepository.ts' | ||
|
||
export default class InMemoryAuthRepository extends InMemoryRepository implements AuthRepository { | ||
restore (): Promise<Session> { | ||
return this.promisify({ | ||
username: 'memory', | ||
abilities: [] | ||
}) | ||
} | ||
|
||
signIn (username: string, password: string): Promise<Session> { | ||
return this.promisify({ | ||
username: username + ':' + password, | ||
abilities: [] | ||
}) | ||
} | ||
|
||
signInWithOtp (username: string): Promise<Session> { | ||
return this.promisify({ | ||
username: username, | ||
abilities: [] | ||
}) | ||
} | ||
|
||
signOut (): Promise<boolean> { | ||
return Promise.resolve(true) | ||
} | ||
|
||
} |
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,9 @@ | ||
export default class InMemoryRepository { | ||
async promisify <T>(data: T): Promise<T> { | ||
const timeout = import.meta.env.VITE_IN_MEMORY_TIMEOUT || 300 | ||
return new Promise((resolve) => { | ||
const handler = () => resolve(data) | ||
window.setTimeout(handler, Number(timeout)) | ||
}) | ||
} | ||
} |
Oops, something went wrong.