Skip to content

Commit

Permalink
[Refactor] Depricated configuration context
Browse files Browse the repository at this point in the history
Depricated configuration context of .env variables.
References #21, #22.
  • Loading branch information
angel-penchev committed Feb 23, 2022
1 parent 8d06615 commit 6035f28
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
6 changes: 5 additions & 1 deletion client/src/components/LoginForm/LoginForm.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ import '@testing-library/jest-dom/extend-expect';
import LoginForm from './LoginForm';

describe('<LoginForm />', () => {
test('it should mount', () => {
beforeEach(() => {
render(<LoginForm />);
});

test('it should mount', () => {
const loginForm = screen.getByTestId('LoginForm');

expect(loginForm).toBeInTheDocument();
});

// test('', () => {});
});
5 changes: 2 additions & 3 deletions client/src/components/LoginForm/LoginForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@ import {
Typography,
} from '@mui/material';
import axios from 'axios';
import React, { FC, useContext } from 'react';
import React, { FC } from 'react';
import { useFormik } from 'formik';
import { configurationContext } from '../../contexts/ConfigurationContext';
import styles from './LoginForm.module.scss';

const LoginForm: FC<{}> = () => {
const apiRoot = useContext(configurationContext).api.root;
const apiRoot = process.env.REACT_APP_API_ROOT;
const apiLoginEndpoint = `${apiRoot}/auth/login`;
const validationSchema = yup.object({
username: yup.string().required('Username is required.'),
Expand Down
6 changes: 3 additions & 3 deletions client/src/components/OtherLoginOptions/OtherLoginOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import {
PersonOutlined,
} from '@mui/icons-material';
import { Button, Container, Grid } from '@mui/material';
import React, { FC, useContext } from 'react';
import { configurationContext } from '../../contexts/ConfigurationContext';
import React, { FC } from 'react';
import { UserContext } from '../../contexts/UserContext';
import styles from './OtherLoginOptions.module.scss';

const OtherLoginOptions: FC<{}> = () => {
const apiRoot = useContext(configurationContext).api.root;
const apiRoot = process.env.REACT_APP_API_ROOT;
const apiLoginEndpoint = `${apiRoot}/auth/login`;

const login = (service: 'google' | 'discord' | 'github') => {
Expand Down
3 changes: 1 addition & 2 deletions client/src/components/RegisterForm/RegisterForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ import React, { FC, useContext } from 'react';
import * as yup from 'yup';
import 'yup-phone';
import { Button, Container, Grid, TextField, Typography } from '@mui/material';
import { configurationContext } from '../../contexts/ConfigurationContext';
import { useFormik } from 'formik';
import styles from './RegisterForm.module.scss';
import axios from 'axios';

const RegisterForm: FC<{}> = () => {
const apiRoot = useContext(configurationContext).api.root;
const apiRoot = process.env.REACT_APP_API_ROOT;
const apiRegisterEndpoint = `${apiRoot}/auth/register`;
const validationSchema = yup.object({
username: yup.string().min(3).required('Username is required.'),
Expand Down

0 comments on commit 6035f28

Please sign in to comment.