Skip to content

jacksonet00/wrapped-firebase

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wrapped-firebase

a small firebase library for improved error handling

Installation

npm i wrapped-firebase

Example

import { getAuth } from "firebase/auth";
import { getFirestore } from "firebase/firestore";
import { fetchFirestoreDocument } from "wrapped-firebase";

async function fetchUserData() {
  const ref = doc(getFirestore(), "users", getAuth().currentUser.uid!);
  const [res, error] = await fetchFirestoreDocument(ref);

  if (error) {
    // handle error
    return null;
  }
  
  return {
    id: res.snapshot.id,
    data: res.snapshot.data()
  };
}

About

a small firebase library for improved error handling

Resources

Stars

Watchers

Forks

Packages

No packages published