Fix sign up form bug

This commit is contained in:
jwu-fisker
2021-01-08 15:06:19 -08:00
parent 26e25a5b23
commit 1a7ad4c2a2
5 changed files with 54 additions and 15 deletions

View File

@@ -3,6 +3,8 @@ import React from 'react';
let token = null;
let fetching = false;
let error = null;
let signInResp = {};
let signUpResp = {};
export const UserProvider = ({ children }) => {
return (
@@ -16,10 +18,13 @@ export const useUserContext = () => ({
token,
fetching,
error,
setError: jest.fn(),
signIn: jest.fn(),
signUp: jest.fn(),
setError: jest.fn((value) => {
error = value;
}),
signIn: jest.fn(() => signInResp),
signUp: jest.fn(() => signUpResp),
signOut: jest.fn(),
signUpAndIn: jest.fn(),
});
export const setToken = (val) => {
@@ -33,3 +38,7 @@ export const setFetching = (val) => {
export const setError = (val) => {
error = val;
};
export const setSignUpResp = (val) => {
signUpResp = val;
};