Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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を返します。
*/
getAuth() {
return auth;
},
/**
return;
}
if (!data || !data.name) {
this.errorService.error('Image not valid.');
resolve();
return;
}
if (data.size > 10485760) {
this.errorService.error(`Image is too big (max. ${maxSize / 1048576} Mb)`);
resolve();
return;
}
const ref: Reference = firebase.storage().ref(`${authUser.uid}/assets/${folder}/${data.name}`);
await ref.put(data);
resolve({
downloadUrl: await ref.getDownloadURL(),
fullPath: ref.fullPath,
name: ref.name
});
});
} catch (err) {