]> PHS Git Server - phs-admin.git/commitdiff
Cleaning up code warnings and errors.
authorcharleswrayjr <charleswrayjr@gmail.com>
Sat, 13 Sep 2025 22:59:41 +0000 (17:59 -0500)
committercharleswrayjr <charleswrayjr@gmail.com>
Sat, 13 Sep 2025 22:59:41 +0000 (17:59 -0500)
.idea/dictionaries/project.xml [new file with mode: 0644]
.idea/inspectionProfiles/Project_Default.xml
README.md
src/app/components/AuthContext.js
tailwind.config.js

diff --git a/.idea/dictionaries/project.xml b/.idea/dictionaries/project.xml
new file mode 100644 (file)
index 0000000..bbf6451
--- /dev/null
@@ -0,0 +1,7 @@
+<component name="ProjectDictionaryState">
+  <dictionary name="project">
+    <words>
+      <w>ovpn</w>
+    </words>
+  </dictionary>
+</component>
\ No newline at end of file
index 03d9549ea8e4ada36fb3ecbc30fef08175b7d728..3044da6c5378bca8d1db87902523dcccf79e6fbf 100644 (file)
@@ -1,6 +1,17 @@
 <component name="InspectionProjectProfileManager">
   <profile version="1.0">
     <option name="myName" value="Project Default" />
+    <inspection_tool class="CssUnknownProperty" enabled="true" level="WARNING" enabled_by_default="true">
+      <option name="myCustomPropertiesEnabled" value="true" />
+      <option name="myIgnoreVendorSpecificProperties" value="false" />
+      <option name="myCustomPropertiesList">
+        <value>
+          <list size="1">
+            <item index="0" class="java.lang.String" itemvalue="tab-size" />
+          </list>
+        </value>
+      </option>
+    </inspection_tool>
     <inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
   </profile>
 </component>
\ No newline at end of file
index 58beeaccd87e230076cab531b8f418f40b6d1aeb..76e91cf3b55a3a32bae2cdbb96815892e238a4db 100644 (file)
--- a/README.md
+++ b/README.md
@@ -35,9 +35,9 @@ See the section about [deployment](https://facebook.github.io/create-react-app/d
 
 If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
 
-Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
+Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc.) right into your project so you have full control over them. All the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
 
-You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
+You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you could not customize it when you are ready for it.
 
 ## Learn More
 
index 290b9a994bc3b6fa11a6ff26d9c554c51784091b..91035fcb6745c248ab0af8e7fea9a62e5946735c 100644 (file)
@@ -2,58 +2,58 @@
  * @file Authentication context for user and role data
  */
 
-import React, { createContext, useState, useEffect } from 'react';
+import React, { createContext, useEffect, useMemo, useState } from 'react';
 import { useNavigate } from 'react-router-dom';
 import { useSnackbar } from 'notistack';
 import { AuthService } from '../services/auth';
 
-export const AuthContext = createContext();
+export const AuthContext = createContext( undefined );
 
-export const AuthProvider = ({ children }) => {
-  const [user, setUser] = useState(null);
+export const AuthProvider = ( { children } ) => {
+  const [user, setUser] = useState( null );
   const navigate = useNavigate();
   const { enqueueSnackbar } = useSnackbar();
 
-  useEffect(() => {
-    const fetchUser = async () => {
-      try {
-        const token = localStorage.getItem('token');
-        if (token) {
-          const response = await AuthService.getCurrentUser();
-          setUser(response.user);
-        }
-      } catch (error) {
-        enqueueSnackbar(`Error fetching user: ${error.message}`, { variant: 'error' });
+  const fetchUser = useMemo( () => async () => {
+    try {
+      const token = localStorage.getItem( 'token' );
+      if (token) {
+        const response = await AuthService.getCurrentUser();
+        setUser( response.user );
       }
-    };
-    fetchUser();
-  }, [enqueueSnackbar]);
+    } catch (error) {
+      enqueueSnackbar( `Error fetching user: ${ error.message }`, { variant:'error' } );
+    }
+  }, [enqueueSnackbar] );
+  useEffect( () => {
+    fetchUser().catch();
+  }, [enqueueSnackbar, fetchUser] );
 
-  const login = async (email, password) => {
+  const login = async ( email, password ) => {
     try {
-      const response = await AuthService.login(email, password);
+      const response = await AuthService.login( email, password );
       if (response.success) {
-        localStorage.setItem('token', response.token);
-        setUser(response.user);
-        navigate('/');
+        localStorage.setItem( 'token', response.token );
+        setUser( response.user );
+        navigate( '/' );
         return true;
       }
       return false;
     } catch (error) {
-      enqueueSnackbar(`Login error: ${error.message}`, { variant: 'error' });
+      enqueueSnackbar( `Login error: ${ error.message }`, { variant:'error' } );
       return false;
     }
   };
 
   const logout = () => {
-    localStorage.removeItem('token');
-    setUser(null);
-    navigate('/login');
+    localStorage.removeItem( 'token' );
+    setUser( null );
+    navigate( '/login' );
   };
 
   return (
-    <AuthContext.Provider value={{ user, setUser, login, logout }}>
-      {children}
+    <AuthContext.Provider value={ { user, setUser, login, logout } }>
+      { children }
     </AuthContext.Provider>
   );
 };
\ No newline at end of file
index f2b75db58e066494e91548b3e828891abe450f6c..c0f998f28ce678b58025d0ca292db12ea47ccaa9 100755 (executable)
@@ -1,5 +1,7 @@
 /** @type {import('tailwindcss').Config} */
 /* eslint-disable import/no-extraneous-dependencies */
+// noinspection SpellCheckingInspection
+
 const path = require('path');
 
 module.exports = {