Skip to content

Commit

Permalink
Testing out webstorm
Browse files Browse the repository at this point in the history
Cleaned up imports on types.ts
  • Loading branch information
aleksanderbrymora committed Aug 19, 2020
1 parent afa35ec commit 3d68e31
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/firebase-hooks-react.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions src/auth/types.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import {SyntheticEvent, ChangeEvent} from 'react'

export type InputObject = {
value: string;
type: string; // todo set only to available input types
required: boolean;
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
onChange: (e: ChangeEvent<HTMLInputElement>) => void;
};

// Return structure for every useAuth hook type
Expand All @@ -15,15 +17,15 @@ export type AuthReturnType<DataType> = [

// Types for objects to be spread in the jsx elements
export type EmailPasswordEventType = {
onSubmit: (e: React.SyntheticEvent) => Promise<void>;
onSubmit: (e: SyntheticEvent) => Promise<void>;
};

export type SignoutEventType = {
onClick: (e: React.SyntheticEvent) => Promise<void>;
onClick: (e: SyntheticEvent) => Promise<void>;
};

export type EmailPasswordConfirmType = {
onSubmit: (e: React.SyntheticEvent) => Promise<void>;
onSubmit: (e: SyntheticEvent) => Promise<void>;
};

// DataType types for useAuth
Expand Down
8 changes: 4 additions & 4 deletions src/auth/useR.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { useEffect, useState } from 'react';
import { useFire } from '../context/FirebaseContext';
import {useEffect, useState} from 'react';
import {useFire} from '../context';

export const useR = () => {
const [loading, setLoading] = useState<boolean>(false);
const [user, setUser] = useState<false | firebase.User>(false);
const { auth } = useFire();
useEffect(() => {
setLoading(true);
const unsubscribe = auth!.onAuthStateChanged(user => {
return auth!.onAuthStateChanged(user => {
user ? setUser(user) : setUser(false);
setLoading(false);
});
return unsubscribe;
}, []);
return { loading, user };
};

0 comments on commit 3d68e31

Please sign in to comment.