All files / web/modules/auth api.ts

40% Statements 8/20
100% Branches 0/0
0% Functions 0/10
40% Lines 8/20

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 492x   1x             1x             1x             1x           1x             1x             1x          
import Auth from '@aws-amplify/auth';
 
export const signIn = (username: string, password: string) =>
  new Promise((resolve, reject) => {
    Auth.signIn(username, password)
      .then(resolve)
      .catch(reject);
  });
 
export const setNewPassword = (authData: any, password: string) =>
  new Promise((resolve, reject) => {
    Auth.completeNewPassword(authData, password, [])
      .then(resolve)
      .catch(reject);
  });
 
export const forgotPassword = (username: string) =>
  new Promise((resolve, reject) => {
    Auth.forgotPassword(username)
      .then(resolve)
      .catch(reject);
  });
 
export const forgotPasswordSubmit = async (
  username: string,
  code: string,
  password: string,
) => Auth.forgotPasswordSubmit(username, code, password);
 
export const currentAuthenticatedUser = () =>
  new Promise((resolve, reject) => {
    Auth.currentAuthenticatedUser()
      .then(resolve)
      .catch(reject);
  });
 
export const signOut = () =>
  new Promise((resolve, reject) => {
    Auth.signOut()
      .then(resolve)
      .catch(reject);
  });
 
export const signUp = async (
  username: string,
  password: string,
  email: string,
) => Auth.signUp({ username, password, attributes: { email } });