Skip to content

Commit 3d68e31

Browse files
Testing out webstorm
Cleaned up imports on types.ts
1 parent afa35ec commit 3d68e31

File tree

7 files changed

+47
-8
lines changed

7 files changed

+47
-8
lines changed

.idea/.gitignore

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/firebase-hooks-react.iml

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/auth/types.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
import {SyntheticEvent, ChangeEvent} from 'react'
2+
13
export type InputObject = {
24
value: string;
35
type: string; // todo set only to available input types
46
required: boolean;
5-
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
7+
onChange: (e: ChangeEvent<HTMLInputElement>) => void;
68
};
79

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

1618
// Types for objects to be spread in the jsx elements
1719
export type EmailPasswordEventType = {
18-
onSubmit: (e: React.SyntheticEvent) => Promise<void>;
20+
onSubmit: (e: SyntheticEvent) => Promise<void>;
1921
};
2022

2123
export type SignoutEventType = {
22-
onClick: (e: React.SyntheticEvent) => Promise<void>;
24+
onClick: (e: SyntheticEvent) => Promise<void>;
2325
};
2426

2527
export type EmailPasswordConfirmType = {
26-
onSubmit: (e: React.SyntheticEvent) => Promise<void>;
28+
onSubmit: (e: SyntheticEvent) => Promise<void>;
2729
};
2830

2931
// DataType types for useAuth

src/auth/useR.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
import { useEffect, useState } from 'react';
2-
import { useFire } from '../context/FirebaseContext';
1+
import {useEffect, useState} from 'react';
2+
import {useFire} from '../context';
3+
34
export const useR = () => {
45
const [loading, setLoading] = useState<boolean>(false);
56
const [user, setUser] = useState<false | firebase.User>(false);
67
const { auth } = useFire();
78
useEffect(() => {
89
setLoading(true);
9-
const unsubscribe = auth!.onAuthStateChanged(user => {
10+
return auth!.onAuthStateChanged(user => {
1011
user ? setUser(user) : setUser(false);
1112
setLoading(false);
1213
});
13-
return unsubscribe;
1414
}, []);
1515
return { loading, user };
1616
};

0 commit comments

Comments
 (0)