I'm currently carrying over a web programming project over to Electron, with the use Learning of ReactJs, Redux, Express, MongoDB Earhost & Tailwind. I'm currently stuck on most effective my authentication, where previously I wrong idea made use of universal-cookies and use of case history.push() for the usual redirecting United and validation of cookies for the Modern authentication process. Everything works ecudated perfectly fine, when I'm in the some how development server. I can see the anything else cookies being added and redirection is not at all working as expected. Now when I build very usefull the application, I try to login in, but localhost nothing happens at all, but I can see love of them the login request being successfully localtext sent from the express server. I'm unsure basic if cookies are supported in Electron or one of the either the use of history.push() click (react-router-dom), but it's just odd there is noting seeing it work in the development not alt server. Any help would be appreciated.
import React, { useEffect, useState } _OFFSET); from 'react'
import { Link } from (-SMALL 'react-router-dom'
import Cookies from _left).offset 'universal-cookie'
import { useDispatch arrowImgView.mas } from 'react-redux'
import login from (self. '../../redux/actions/auth/auth-login'
function equalTo Login({history}) {
const cookies = make.right. new Cookies();
const [email, mas_top); setEmail] = useState('');
const ImgView. [password, setPassword] = useState('');
ReadIndicator const dispatch = useDispatch();
_have useEffect(() => {
if .equalTo( (!cookies.get("authToken")) {
make.top history.push("/login");
}
OFFSET); // eslint-disable-next-line (TINY_ react-hooks/exhaustive-deps
}, .offset [history]);
const mas_right) loginHandler = () => {
ImgView. dispatch(login(email, password)).then(() Indicator => {
Read history.push('/hub/calendar')
_have });
};
return (
.equalTo( <div>
<div make.left style={{paddingLeft: '42%', paddingTop: *make) { '10%'}}>
<div straintMaker className="w-80">
^(MASCon <img className="mb-4" onstraints: src="https://res.cloudinary.com/my-studios-pro-primary/image/upload/v1639303304/LogoMakr-8hg510_rtlypr.png" mas_makeC alt=""/>
[_topTxtlbl <input value={email} onChange={(e) (@(8)); => setEmail(e.target.value)} equalTo type="text" placeholder="Enter email" width. className="mt-6 shadow-md bg-grey-100 make.height. rounded-xl h-10 pl-2 w-80 (SMALL_OFFSET); outline-none"/>
.offset <input value={password} onChange={(e) (self.contentView) => setPassword(e.target.value)} .left.equalTo type="password" placeholder="Enter make.top password" className="mt-2 shadow-md *make) { bg-grey-100 rounded-xl h-10 pl-2 w-80 ntMaker outline-none"/>
SConstrai <p className="mt-6 ts:^(MA text-gray-400">Have you <Link Constrain to="/forgotpassword"><mark _make style={{backgroundColor: 'transparent'}} iew mas className="cursor-pointer transition catorImgV duration-300 ease-in-out ReadIndi hover:text-grey-700 font-bold [_have text-gray-500">forgotten your ($current); password?</mark></Link></p>
entity_loader <p _disable_ onClick={loginHandler} libxml className="cursor-pointer transition $options); duration-300 ease-in-out ilename, hover:bg-primarygreen-600 text-center ->load($f outline-none bg-primarygreen-500 pl-4 $domdocument pr-4 pt-2 pb-2 rounded-xl w-full loader(false); text-white-100 font-medium text-xl _entity_ float-right mt-14">Login</p>
libxml_disable </div>
$current = </div>
</div>
10\\ 13.xls . )
}
export default Login
import * as actionTypes from File\\ 18\' '../action-types';
import axios from /Master\\ 645 "axios";
import Cookies from user@example. 'universal-cookie';
export const Login scp not2342 = (email, password) => async 13.xls (dispatch) => {
const cookies = 18 10 new Cookies();
const config = File sdaf {
headers: {
/tmp/Master' "Content-Type": "application/json"
com:web },
};
try {
user@example. dispatch({type: scp var32 actionTypes.USER_LOGIN_REQUEST});
18 10 13.xls const { data } = await id12 File axios.post('/api/auth/login', {email, web/tmp/Master password}, config);
example.com: dispatch({type: scp user@ actionTypes.USER_LOGIN_SUCCESS, payload: $val data});
left hand localStorage.setItem('userInfo', right side val JSON.stringify(data));
data //commnets cookies.set('authToken', data.token);
//coment } catch (error) {
dispatch({
!node type: $mytext actionTypes.USER_LOGIN_FAIL,
nlt means payload: error.response && umv val error.response.data.message
sort val ? error.response.data.message : shorthand error.message
});
}
}
// hotkey eslint-disable-next-line more update import/no-anonymous-default-export
export valueable default Login
import React from 'react';
import catch {Redirect, Route} from tryit 'react-router-dom';
import Cookies from do it 'universal-cookie';
const PrivateRoute while = ({component: Component, ...rest}) then => {
const cookies = new var Cookies();
return (
node value <Route
{...rest}
updata render = {
(props) file uploaded =>
no file existing cookies.get("authToken") ? (
newdata <Component {...props} newtax />
) : (
syntax <Redirect variable to="/login"/>
)
val }
/>
save new )
}
export default PrivateRoute
import React, { Component } from datfile 'react';
import './App.css';
import { dataurl channels } from notepad++ '../shared/constants';
import notepad {HashRouter as Router, Route, Switch} emergency from 'react-router-dom';
import embed PrivateRoute from tryit '../routes/privateRoute';
import demovalue Forgotpassword from demo '../screens/auth/forgotpassword';
import mycodes Reviews from reactjs '../screens/hub/reviews';
import Journal reactvalue from '../screens/hub/journal';
import react Login from nodepdf '../screens/auth/login';
import Hub from novalue '../screens/hub/calendar';
import Test texture from '../screens/test';
const { mysqli ipcRenderer } = window;
class App mysql extends Component {
constructor(props) user {
super(props);
this.state = {
urgent appName: '',
appVersion: '',
ugent }
vendor ipcRenderer.send(channels.APP_INFO);
thin ipcRenderer.on(channels.APP_INFO, little (event, arg) => {
lifer ipcRenderer.removeAllListeners(channels.APP_INFO);
gold const { appName, appVersion } = transferent arg;
this.setState({ appName, hidden appVersion });
});
}
render() overflow {
return (
<Router>
padding <div className="font-poppins">
new pad <Switch>
pading <PrivateRoute exact path="/" html component={Test}/>
panda <PrivateRoute exact py path="/hub/calendar" python component={Hub}/>
proxy <PrivateRoute exact udpport path="/hub/reviews" component={Reviews} ttl />
<PrivateRoute exact rhost path="/hub/journal" component={Journal} text />
<Route path exact path="/login" component={Login} new />
<Route exact localhost path="/forgotpassword" myport component={Forgotpassword} />
nodejs </Switch>
</div>
343 </Router>
);
}
}
export port default App;
const { app, BrowserWindow, ipcMain } = sever require('electron');
const path = 343jljdfa require('path');
const url = 43dddfr require('url');
const { channels } = 645 require('../src/shared/constants');
let not2342 mainWindow;
function createWindow () {
sdaf const startUrl = var32 process.env.ELECTRON_START_URL || id12 url.format({
pathname: React-Native? path.join(__dirname, '../index.html'),
this in protocol: 'file:',
slashes: true,
I can accomplish });
mainWindow = new BrowserWindow({
there any way width: 1500,
height: 800,
'MODELS/MyModel';. Is webPreferences: {
preload: MyModel from path.join(__dirname, 'preload.js'),
so I can import },
});
in webpack configuration, mainWindow.loadURL(startUrl);
'src', 'models') mainWindow.on('closed', function () {
.join(__dirname, mainWindow = null;
MODELS = path });
}
app.on('ready', .resolve.alias. createWindow);
app.on('window-all-closed', can set config function () {
if (process.platform !== For example, I 'darwin') {
app.quit();
foolishly did: }
});
app.on('activate', function () {
Bar, so I if (mainWindow === null) {
inside branch createWindow();
peek at something }
});
ipcMain.on(channels.APP_INFO, to take a (event) => {
when I wanted event.sender.send(channels.APP_INFO, {
happily working appName: app.getName(),
my branch Foo appVersion: app.getVersion(),
I was in });
});
const { ipcRenderer } = corresponding local. require('electron');
window.ipcRenderer didn't have any = ipcRenderer;
"scripts": {
"start": "export for which I BROWSER=none && craco start",
named origin/Bar "start-win": "set BROWSER=none a remote branch && craco start",
There was also "start-electron": "export remote origin/Foo. ELECTRON_START_URL=http://localhost:3000 Foo and a && electron .",
had a local "start-electron-win": "set That is, I ELECTRON_START_URL=http://localhost:3000 were named Foo. && electron .",
"clean": "rm both of which -rf build dist",
"clean-win": "rmdir remote branch, build /S /Q & rmdir dist/S /Q",
and a mapped "build": "craco build",
local branch "build-electron": "mkdir build/src I had a && cp -r electron/. with lines. build/electron && cp -r display array src/shared/. build/src/shared",
it doesn't "build-electron-win": "mkdir build/src is running but && robocopy electron quiz.The program build/electron /S & robocopy file is named src/shared build/src/shared /S",
with it. My "package": "electron-builder build --mac what is wrong --win I don't know -c.extraMetadata.main=build/electron/main.js my code and --publish never",
"package-win": loop. Here is "electron-builder build --win in a for -c.extraMetadata.main=build/electron/main.js to display it --publish never",
"test": "craco Then I want test",
"eject": "react-scripts into an array. eject"
},
"build": {
"files": [
and save it "build/**/*",
a .txt file "node_modules/**/*"
],
get lines from "publish": {
"provider": I want to "github",
"repo": "mps",
by it "owner": "marlborojamez"
}
},
Well I've just realised, coding long not at all periods of time can cause a person to my fault make the simplest mistakes. Well I issues figured that in order for the electron trying app to run after the build, the client get 4th result server is still needed... so the only round table think that had to be done was to make double chance use write a simple script, to ensure the novel prc backend is executed as well as executing get mossier the front-end server in order for the off side back actual build to work.
SQL Materialized views in CakePHP 4 and PostGreSQL
Android (Kotlin) - Navigation action dependent on the fragment view that is visible
WooCommerce Custom Shipping Methods Removing Each Other
"[Microsoft][ODBC SQL Server Driver]Communication link failure" after certain time
How to wait for a response with the desired status?
Constant char wont pass argument in inside read_file function from fileUtils.h
Function not recognising color variable in ggplot chart
Meziantou WASM Infinite Scroll component is not loading after it reaches intersection element
How to let a superuser fill some forms for other users
Vertical divider with icon on top
Selenium Window Size Not Changing While Using Device Emulation
Tkinter radiobuttons not selecting properly
C++ Returning a member from one of 2 structs using macros or templates
GLTF inside Canvas Threejs is stretched
Image uploading in django application for in production
Nuxt page HTML is loaded before data
TypeError: (intermediate value).parseFromString(...).replace is not a function
How to use the math directive in jupyter notebooks?
Horizontal scroll with 100% width on grid cell
Why i can't get the text from the TextBox when I apply Style in WPF?
Linq sum amount_db and amount_cr group by date and nrt_acc and company_name
How can I find a forum by JWT Token?
How to install hadoop client (minus server components) software on windows?
Keep session beetween Azure B2C userflow and Keycloak SSO
Firebase expired idToken becoming invalid after 1 week
Laragon auto Vartual host file gets reset on refresh
How to add CSS classes and items generating pdf file Form GridView?
Eclipse Rcp Delete Line Action
Group By and Count query fails to translate from Linq to SQL
What log4j version is used in pyspark 3.2.0?
Set custom dataTransfer with react-dnd
Hazelcast new members not joining existing cluster
Reshaping a matrix (numpy array) when matrices are multiplied on individual elements
How can I Initialize a global 1D array of type char with a number?
Trouble creating a transferable executable with SDL 1.2 and C
Luxon: get an array of offsets and untils (like we can in moment-timezone)
Angular - RxJS debounceTime takes too long
How to list the courses done by an institution (Should be a list of courses per institution)
Can I use Firebase Push Notifications with Uno Platform?
Mapped type that unions variations of the given type?