Unverified Commit 6a8aef71 authored by Marcus Koh's avatar Marcus Koh Committed by GitHub

Updated with-firebase-authentication to fix errors (#12204)

parent 4624c09f
...@@ -6,10 +6,14 @@ import 'isomorphic-unfetch' ...@@ -6,10 +6,14 @@ import 'isomorphic-unfetch'
import clientCredentials from '../credentials/client' import clientCredentials from '../credentials/client'
export async function getServerSideProps({ req, query }) { export async function getServerSideProps({ req, query }) {
const user = req && req.session ? req.session.decodedToken : null const user =
req.session && req.session.decodedToken ? req.session.decodedToken : null
// don't fetch anything from firebase if the user is not found // don't fetch anything from firebase if the user is not found
// const snap = user && await req.firebaseServer.database().ref('messages').once('value') // const snapshot = user && (await req.firebaseServer.firestore().collection('messages').get())
// const messages = snap && snap.val() // let messages = []
// snapshot.forEach(function(doc) {
// messages.push(doc.data())
// });
const messages = null const messages = null
return { return {
props: { props: {
......
...@@ -13,6 +13,7 @@ const handle = app.getRequestHandler() ...@@ -13,6 +13,7 @@ const handle = app.getRequestHandler()
const firebase = admin.initializeApp( const firebase = admin.initializeApp(
{ {
credential: admin.credential.cert(require('./credentials/server')), credential: admin.credential.cert(require('./credentials/server')),
// databaseURL: "https://<YOUR_PROJECT>.firebaseio.com",
}, },
'server' 'server'
) )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment