This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const persons = realm.objects('Person').filtered('name NOT IN $0', namesToSearch); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Realm from 'realm'; | |
const PersonSchema = { | |
name: 'Person', | |
properties: { | |
id: 'string', | |
name: 'string', | |
}, | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Platform, NativeModules } from 'react-native'; | |
const { FileSystem } = NativeModules; | |
const path = `${FileSystem.documentDirectory}/myFile.txt`; | |
FileSystem.getInfo(path) | |
.then(stats => { | |
if (stats.exists) { | |
console.log('File exists'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import RNFS from 'react-native-fs'; | |
const filePath = RNFS.DocumentDirectoryPath + '/example.txt'; | |
RNFS.exists(filePath) | |
.then((exists) => { | |
if (exists) { | |
console.log('File exists'); | |
} else { | |
console.log('File does not exist'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Realm from 'realm'; | |
const PersonSchema = { | |
name: 'Person', | |
properties: { | |
name: 'string', | |
age: 'int', | |
}, | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from 'react'; | |
import { Button, Grid, IconButton, InputAdornment, TextField } from "@mui/material"; | |
import { Visibility, VisibilityOff } from "@mui/icons-material"; | |
import { useSnackbar } from 'notistack'; | |
import { NavLink, useNavigate } from 'react-router-dom'; | |
import AuthService from '../services/auth'; | |
const Login = () => { | |
const [passwordVisibility, setPasswordVisibility] = useState(false); | |
const [processing, setProcessing] = useState(false); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AuthService.login = (email, password) => { | |
const fauth = getAuth(); | |
return new Promise((resolve, reject) => { | |
signInWithEmailAndPassword(fauth, email, password).then((user) => { | |
if (user) { | |
resolve({ status: true, message: "Login successfully." }); | |
} else { | |
resolve({ status: false, message: "Incorrect Email or Password." }); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AuthService.logout = async () => { | |
return new Promise((resolve) => { | |
const fauth = getAuth(); | |
fauth.signOut().then(() => { | |
resolve({ status: true, message: "Logged out successfully." });; | |
}).catch(err => { | |
resolve({ status: true, message: "Logged out successfully." }); | |
}); | |
}) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { PowerSettingsNew } from '@mui/icons-material'; | |
import { Button, Grid } from '@mui/material'; | |
import { useSnackbar } from 'notistack'; | |
import React, { useEffect, useState } from 'react'; | |
import { useNavigate } from 'react-router-dom'; | |
import AuthService from '../services/auth'; | |
const Welcome = () => { | |
const [name, setName] = useState(""); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useEffect, useState } from 'react'; | |
import { useNavigate } from 'react-router-dom'; | |
import AuthService from '../services/auth'; | |
const UnAuthGuard = ({ component }) => { | |
const [status, setStatus] = useState(false); | |
const navigate = useNavigate(); | |
useEffect(() => { | |
checkToken(); |
NewerOlder