Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import wkn from 'wkn';
import constants from '../constants';
import firebaseConf from '../configs/firebase';
const parser = new UAParser();
const browserName = parser.getBrowser().name;
const osName = parser.getOS().name;
const deviceType = parser.getDevice().type;
let database;
let auth;
let messaging;
let storage;
if (process.env.NODE_ENV !== 'test') {
firebase.initializeApp(firebaseConf);
database = firebase.database();
auth = firebase.auth();
if (constants.SUPPORTEDBROWSERS.indexOf(browserName) >= 0 && osName !== 'iOS') { // safari,iosではエラーになるため
messaging = firebase.messaging();
}
storage = firebase.storage();
}
export default {
/**
* firebaseのdatabaseを返します。
*/
getDatabase() {
return database;
},
/**
* firebaseのauthを返します。
import {firebase} from '@firebase/app';
import '@firebase/auth';
import '@firebase/database';
import config from '../config';
const appFirebase = firebase.initializeApp({
apiKey: config.firebaseApiKey,
authDomain: `${config.firebaseApp}.firebaseapp.com`,
databaseURL: `https://${config.firebaseApp}.firebaseio.com`,
});
const auth = firebase.auth(appFirebase);
const database = firebase.database(appFirebase);
const githubAuthProvider = new firebase.auth.GithubAuthProvider();
githubAuthProvider.addScope('gist');
githubAuthProvider.addScope('public_repo');
export {auth, database, githubAuthProvider};