0.2.0 • Published 2 years ago

firerr v0.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

FirErr

FirErr is a package for catching Firebase Errors that often occurs. Firebase can only send one response at a time, so catching it one-by-one is not that bad, I think.

🤔 Usage

You can use it by defining a state, or variables that store the Firebase Error Message :

import { useState } from "react";

const [formError, setFormError] = useState("");

Then do some 🔥 Firebase Stuff :

async function login(e) {
    e.preventDefault();
    await createUserWithEmailAndPassword(auth, formEmail, formPassword)
        .then(() => {
            // finish
        })
        .catch((error) => {
            const code = error.code;
            firerr(code, formError);
        });
}

firerrString() function

import { firerrString } from "firerr";

async function login(e) {
    e.preventDefault();
    await createUserWithEmailAndPassword(auth, formEmail, formPassword)
        .then(() => {
            // finish
        })
        .catch((error) => {
            const code = error.code;
            alert(firerrString(code));
        });
}

🥶 Idk who install this package tho... This is my very first NPM Package. I am very sorry if there's a problem! I'm only 14 yo, 15 next September 🤧

- qwyzex, 2022

0.2.0

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago