AuthHttpService.ts 861 B

12345678910111213141516171819202122232425262728
  1. import { KeyParamsData } from '@standardnotes/responses'
  2. import { AxiosInstance } from 'axios'
  3. import { AuthHttpServiceInterface } from '../../Domain/Auth/AuthHttpServiceInterface'
  4. export class AuthHttpService implements AuthHttpServiceInterface {
  5. constructor(
  6. private httpClient: AxiosInstance,
  7. private authServerUrl: string,
  8. ) {}
  9. async getUserKeyParams(dto: { email?: string; uuid?: string; authenticated: boolean }): Promise<KeyParamsData> {
  10. const keyParamsResponse = await this.httpClient.request({
  11. method: 'GET',
  12. timeout: 10000,
  13. headers: {
  14. Accept: 'application/json',
  15. },
  16. url: `${this.authServerUrl}/users/params`,
  17. params: dto,
  18. validateStatus:
  19. /* istanbul ignore next */
  20. (status: number) => status >= 200 && status < 500,
  21. })
  22. return keyParamsResponse.data
  23. }
  24. }