();
@@ -54,7 +56,7 @@ function Start() {
let response;
if (!token) {
- setLogin(false);
+ contextObj.setLogin(false);
setMessageObj({ isError: true, status: "403", message: "No valid login" })
return false;
}
@@ -101,7 +103,7 @@ function Start() {
return;
}
- if (error.response.status == 403) { setLogin(false) }
+ if (error.response.status == 403) { contextObj.setLogin(false) }
setMessageObj({ isError: true, status: error.response.data.status || error.response.status, message: error.response.data.message || error.message });
@@ -112,11 +114,11 @@ function Start() {
};
useEffect(() => {
- if (isLoggedIn) {
+ if (contextObj.isLoggedIn) {
getData();
intervalID.current = setInterval(getData, fetchIntervalMs); // capture interval ID as return from setInterval and pass to state
return () => { console.log("cleanup"); clearInterval(intervalID.current); intervalID.current = null; };
- } else if (userInfo) { // no valid login but userInfo
+ } else if (contextObj.userInfo) { // no valid login but userInfo
setMessageObj({ isError: true, status: "403", message: "Login expired" })
}
}, []);
@@ -130,22 +132,22 @@ function Start() {
{messageObj.status} {messageObj.message}
}
- {!messageObj.isError && userInfo &&
+ {!messageObj.isError && contextObj.userInfo &&
- {userInfo.user} Welcome back
+ {contextObj.userInfo.user} Welcome back
}
@@ -161,10 +163,10 @@ function Start() {
- {isLoggedIn && intervalID &&
+ {contextObj.isLoggedIn && intervalID &&
}
- {isLoggedIn && intervalID && entries?.length > 0 &&
+ {contextObj.isLoggedIn && intervalID && entries?.length > 0 &&
<>
GPS:
{entries.at(-1).lat} / {entries.at(-1).lon}
diff --git a/tsconfig.json b/tsconfig.json
index 64098b6..61c6e53 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,21 +1,28 @@
{
"extends": "@tsconfig/node20/tsconfig.json",
- "include": ["src/**/*"],
- "exclude": ["node_modules", "src/client/"],
+ "include": [
+ "src/**/*"
+ ],
+ "exclude": [
+ "node_modules",
+ "src/client/"
+ ],
"compilerOptions": {
- "rootDir": "src",
- "outDir": "dist",
- "module": "CommonJS",
- "moduleResolution": "node",
- "target": "ES6",
- "sourceMap": true,
- "baseUrl": "./src",
- "esModuleInterop": true,
- "paths": {
- "@src/*": ["./*"],
- }
+ "rootDir": "src",
+ "outDir": "dist",
+ "module": "CommonJS",
+ "moduleResolution": "node",
+ "target": "ES6",
+ "sourceMap": true,
+ "baseUrl": "./src",
+ "esModuleInterop": true,
+ "paths": {
+ "@src/*": [
+ "./*"
+ ],
+ }
},
"files": [
- "types.d.ts"
- ]
+ "types.d.ts"
+ ]
}
\ No newline at end of file
diff --git a/views/index.ejs b/views/index.ejs
index ff3d550..2663cd1 100644
--- a/views/index.ejs
+++ b/views/index.ejs
@@ -15,7 +15,6 @@
-
diff --git a/webpack.config.js b/webpack.config.js
index 4e5df71..641fd28 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -15,7 +15,7 @@ module.exports = (args) => {
configFile: 'src/client/tsconfig.json'
}
},
- exclude: /node_modules/,
+ exclude: /node_modules/
},
{
test: /\.css$/,
@@ -34,16 +34,16 @@ module.exports = (args) => {
{
test: /\.css$/,
use: ["style-loader", "css-loader"],
- exclude: /\.module\.css$/,
+ exclude: /\.module\.css$/
},
],
},
resolve: {
- extensions: ['.tsx', '.ts', '.js'],
+ extensions: ['.tsx', '.ts', '.js']
},
output: {
filename: 'bundle.js',
- path: path.resolve(__dirname, 'dist/httpdocs/js'),
+ path: path.resolve(__dirname, 'dist/httpdocs/js')
}
}
};