Skip to content

Commit

Permalink
Added .env file.
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenFeddes committed Sep 16, 2023
1 parent aa07282 commit 24ec8f0
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 20 deletions.
22 changes: 11 additions & 11 deletions node_modules/.vite/deps/_metadata.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/authentication/AuthContext.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { createContext, useContext, useState, useEffect } from 'react';
import { API_URL } from '../../env';
const API_URL = import.meta.env.VITE_API_URL;

interface AuthState {
isAuthenticated: boolean;
Expand Down
3 changes: 2 additions & 1 deletion src/components/DraftRoom/DraftContext.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React, { createContext, useContext, useEffect, useState } from 'react';
import { io, Socket } from 'socket.io-client';
import { addPlayer, shiftPlayer, DraftRoster, Player } from '../../utils/draft';
import { API_URL, SERVER_URL } from '../../../env';
import { useAuth } from '../../authentication/AuthContext';
const API_URL = import.meta.env.VITE_API_URL;
const SERVER_URL = import.meta.env.VITE_SERVER_URL;

interface SocketContextProps {
children: React.ReactNode;
Expand Down
2 changes: 1 addition & 1 deletion src/components/DraftRoom/RosterPickList.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import '../../css/draftRoom/rosterPickList.css';
import React, { useEffect, useState, useRef } from 'react';
import { API_URL } from '../../../env';
import { useAuth } from '../../authentication/AuthContext';
import { useDraft } from './DraftContext';
import { User } from '../../utils/users';
import { FaChevronDown } from 'react-icons/fa';
const API_URL = import.meta.env.VITE_API_URL;

const RosterPickList = () => {

Expand Down
2 changes: 1 addition & 1 deletion src/components/DraftRoom/center/PlayersTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import '../../../css/draftRoom/center/playersTable.css';
import React, { useEffect, useState } from 'react';
import { useDraft } from '../DraftContext';
import { useAuth } from '../../../authentication/AuthContext';
import { API_URL } from '../../../../env';
import { addPlayer, PlayerPreviousSeasonStats } from '../../../utils/draft';
import OutlinedRoundedButton from '../../buttons/OutlinedRoundedButton';
const API_URL = import.meta.env.VITE_API_URL;

const PlayersTable = () => {

Expand Down
2 changes: 1 addition & 1 deletion src/components/DraftRoom/header/DraftHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, { useEffect, useState } from 'react';
import { API_URL } from '../../../../env';
import { useDraft } from '../DraftContext';
import { capitalizeWords } from '../../../utils/wordCapitalizer';
import '../../../css/draftHeader.css';
import '../../../css/chatRoom.css';
import ChatRoom from '../ChatRoom';
const API_URL = import.meta.env.VITE_API_URL;

const DraftHeader = () => {

Expand Down
2 changes: 1 addition & 1 deletion src/pages/CreateMockDraft.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { useAuth } from "../authentication/AuthContext";
import PickList from "../components/PickList";
import OutlinedButton from "../components/buttons/OutlinedButton";
import RoundedButton from "../components/buttons/RoundedButton";
import { API_URL } from "../../env";
import { useNavigate } from 'react-router-dom';
const API_URL = import.meta.env.VITE_API_URL;

const ConfigureMockDraft = () => {
const navigate = useNavigate();
Expand Down
2 changes: 1 addition & 1 deletion src/pages/DraftsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import '../css/mockDrafts.css';
import RoundedButton from '../components/buttons/RoundedButton';
import { useNavigate } from 'react-router-dom'; // Import useNavigate
import React, { useState, useEffect } from 'react';
import { API_URL } from '../../env';
import { useAuth } from '../authentication/AuthContext';
import {BsChevronDoubleLeft} from 'react-icons/bs';
import {BsChevronDoubleRight} from 'react-icons/bs';
const API_URL = import.meta.env.VITE_API_URL;

interface DraftInfo {
user_id: number,
Expand Down
2 changes: 1 addition & 1 deletion src/pages/LoginPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import '../css/signupPage.css'
import React, { useState, useEffect } from 'react';
import { useNavigate } from 'react-router-dom';
import TextInput from "../components/TextInput";
import { API_URL } from '../../env';
import { useAuth } from '../authentication/AuthContext';
const API_URL = import.meta.env.VITE_API_URL;

const LoginPage = () => {
const [name, setName] = useState("");
Expand Down
2 changes: 1 addition & 1 deletion src/pages/SignupPage.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import '../css/signupPage.css'
import React, { useState, useEffect } from 'react';
import TextInput from "../components/TextInput";
import { API_URL } from '../../env';
import { useAuth } from '../authentication/AuthContext';
import { IoMdCheckmark } from 'react-icons/io';
import { useNavigate } from 'react-router-dom';
const API_URL = import.meta.env.VITE_API_URL;

const SignupPage = () => {
const navigate = useNavigate();
Expand Down
6 changes: 6 additions & 0 deletions src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
/// <reference types="vite/client" />
// <reference types="vite/client" />

interface ImportMetaEnv {
VITE_API_URL: string;
// Add other environment variables here as needed
}
6 changes: 6 additions & 0 deletions vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/// <reference types="vite/client" />

interface ImportMetaEnv {
VITE_API_URL: string;
// Add other environment variables here as needed
}

0 comments on commit 24ec8f0

Please sign in to comment.