trying to get realm connected

This commit is contained in:
talksik
2022-05-28 03:21:29 -05:00
parent c21c80b8f7
commit 061ac8862f
4 changed files with 14 additions and 7 deletions
+3
View File
@@ -8,6 +8,9 @@ import { SnackbarProvider } from 'notistack';
import { NirvanaTheme } from './mui/NirvanaTheme'; import { NirvanaTheme } from './mui/NirvanaTheme';
import { ElectronProvider } from './providers/ElectronProvider'; import { ElectronProvider } from './providers/ElectronProvider';
import { AuthProvider } from './providers/AuthProvider'; import { AuthProvider } from './providers/AuthProvider';
import realmApp from './realm/connect';
realmApp;
const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement); const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement);
root.render( root.render(
-1
View File
@@ -27,7 +27,6 @@ const createWindow = (): void => {
webPreferences: { webPreferences: {
preload: MAIN_WINDOW_PRELOAD_WEBPACK_ENTRY, preload: MAIN_WINDOW_PRELOAD_WEBPACK_ENTRY,
nodeIntegration: true, nodeIntegration: true,
contextIsolation: false,
}, },
// titleBarStyle: "hiddenInset", // titleBarStyle: "hiddenInset",
frame: false, frame: false,
@@ -1,7 +1,6 @@
import { Button, Container } from '@mui/material'; import { Button, Container } from '@mui/material';
import React, { useContext, useEffect, useCallback } from 'react'; import React, { useContext, useEffect, useCallback } from 'react';
import Realm from 'realm'; import Realm from 'realm';
import realmApp from '../realm/connect';
import { FcGoogle } from 'react-icons/fc'; import { FcGoogle } from 'react-icons/fc';
import { blueGrey } from '@mui/material/colors'; import { blueGrey } from '@mui/material/colors';
@@ -17,7 +16,7 @@ export const AuthProvider = ({ children }: { children: React.ReactNode }) => {
useEffect(() => { useEffect(() => {
window.electronAPI.once(Channels.GOOGLE_AUTH_TOKENS, async (tokens: any) => { window.electronAPI.once(Channels.GOOGLE_AUTH_TOKENS, async (tokens: any) => {
console.log('got tokens', tokens); console.log('got tokens', tokens);
// const credentials = Realm.Credentials.google(tokens);
// realmApp.logIn(credentials).then((user) => alert(`Logged in with id: ${user.id}`)); // realmApp.logIn(credentials).then((user) => alert(`Logged in with id: ${user.id}`));
}); });
}, []); }, []);
+10 -4
View File
@@ -2,10 +2,16 @@ import Realm from 'realm';
const id = 'nirvana-ouauo'; const id = 'nirvana-ouauo';
const config = { const realmApp = new Realm.App({ id });
id,
};
const realmApp = new Realm.App(config); async function run() {
const config = {
id,
};
}
run().catch((err) => {
console.error('Failed to open realm:', err);
});
export default realmApp; export default realmApp;