Use compute auth service and fix static code analyzer warnings (#15)
* Clean up formatting * Use new compute_auth service Implment SSO Implement token refresh Clean up unit tests * Fix unit tests * Fix auth test Fix warnings * Update default settings for compute_auth
This commit is contained in:
@@ -5,11 +5,7 @@ let progress = 0;
|
||||
let status = null;
|
||||
|
||||
export const FileUploadProvider = ({ children }) => {
|
||||
return (
|
||||
<div data-testid="mocked-fileuploadprovider">
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
return <div data-testid="mocked-fileuploadprovider">{children}</div>;
|
||||
};
|
||||
|
||||
export const useFileUploadContext = () => ({
|
||||
|
||||
@@ -1,30 +1,27 @@
|
||||
import React from 'react';
|
||||
import React from "react";
|
||||
|
||||
let token = null;
|
||||
let fetching = false;
|
||||
let error = null;
|
||||
let signInResp = {};
|
||||
let signUpResp = {};
|
||||
let authorizeURL = "https://cognito.com/authorize?redirect=https://example.com/callback";
|
||||
let logoutURL = "https://cognito.com/logout?redirect=https://example.com/callback";
|
||||
|
||||
export const UserProvider = ({ children }) => {
|
||||
return (
|
||||
<div data-testid="mocked-userprovider">
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
return <div data-testid="mocked-userprovider">{children}</div>;
|
||||
};
|
||||
|
||||
export const useUserContext = () => ({
|
||||
token,
|
||||
fetching,
|
||||
error,
|
||||
signIn: jest.fn(() => signInResp),
|
||||
signOut: jest.fn(),
|
||||
getAuthorizeURL: jest.fn(() => authorizeURL),
|
||||
getLogoutURL: jest.fn(() => logoutURL),
|
||||
setError: jest.fn((value) => {
|
||||
error = value;
|
||||
}),
|
||||
signIn: jest.fn(() => signInResp),
|
||||
signUp: jest.fn(() => signUpResp),
|
||||
signOut: jest.fn(),
|
||||
signUpAndIn: jest.fn(),
|
||||
});
|
||||
|
||||
export const setToken = (val) => {
|
||||
@@ -38,7 +35,3 @@ export const setFetching = (val) => {
|
||||
export const setError = (val) => {
|
||||
error = val;
|
||||
};
|
||||
|
||||
export const setSignUpResp = (val) => {
|
||||
signUpResp = val;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user