I am trying to save user details on my db when the user login is successful in my react electron app, what is the best and safest way to do this, because when I try to import DB into my actions file I get this error:
Module not found: Error: You attempted to import ../../../database/connector which falls outside of the project src/ directory. Relative imports outside of src/ are not supported.
How then do I interact with my DB in the safest possible way. Note that I am trying to create an offline version of an app that allows for offline login after the first online login
import { createAsyncThunk } from "@reduxjs/toolkit";
import { http } from "../../config/axios";
import { db } from "../../../database/connector";
export const login = createAsyncThunk("auth/login", async (fd) => {
const res = await http.post("/login", fd);
db.run(
"INSERT INTO users (username, password) VALUES (?, ?)",
[fd.username, fd.password],
function (err) {
if (err) {
return console.error(err.message);
}
}
);
db.close();
});