diff --git a/frontend/domain/models/auth/authRepository.ts b/frontend/domain/models/auth/authRepository.ts new file mode 100644 index 00000000..8661d544 --- /dev/null +++ b/frontend/domain/models/auth/authRepository.ts @@ -0,0 +1,5 @@ +export interface AuthRepository { + login(username: string, password: string): Promise + + logout(): Promise +} diff --git a/frontend/repositories/auth/apiAuthRepository.ts b/frontend/repositories/auth/apiAuthRepository.ts new file mode 100644 index 00000000..440a57b0 --- /dev/null +++ b/frontend/repositories/auth/apiAuthRepository.ts @@ -0,0 +1,18 @@ +import ApiService from '@/services/api.service' +import { AuthRepository } from '@/domain/models/auth/authRepository' + +export class APIAuthRepository implements AuthRepository { + constructor( + private readonly request = ApiService + ) {} + + async login(username: string, password: string): Promise { + const url = `/auth/login/` + await this.request.post(url, { username, password }) + } + + async logout(): Promise { + const url = '/auth/logout/' + await this.request.post(url) + } +}