aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/hooks/useAuth.tsx4
-rw-r--r--src/hooks/useNavigate.tsx4
-rw-r--r--src/pages/ProfilePage/ProfilePage.tsx2
3 files changed, 5 insertions, 5 deletions
diff --git a/src/hooks/useAuth.tsx b/src/hooks/useAuth.tsx
index de64c46..55e142c 100644
--- a/src/hooks/useAuth.tsx
+++ b/src/hooks/useAuth.tsx
@@ -24,7 +24,7 @@ const authContext = createContext<ContextType>({
const useProvideAuth = () => {
const [user, setUser] = useState<User | null>(null);
- const login = (username: string, password: string, remember = true): Promise<boolean> => {
+ const login: ContextType['login'] = (username, password, remember = true) => {
return post('/authentication', {
strategy: 'local',
username,
@@ -71,7 +71,7 @@ export const AuthProvider: React.FC = ({ children }) => {
return <Provider value={auth}>{children}</Provider>;
};
-export const useAuth = () => {
+export const useAuth = (): ContextType => {
return useContext(authContext);
};
diff --git a/src/hooks/useNavigate.tsx b/src/hooks/useNavigate.tsx
index 9513f13..befc529 100644
--- a/src/hooks/useNavigate.tsx
+++ b/src/hooks/useNavigate.tsx
@@ -22,7 +22,7 @@ const context = createContext<ContextType>({
const useProvideNavigation = () => {
const [page, setPage] = useState<Page>(landingPage);
- const navigate = (prefix: string, id?: string): void => {
+ const navigate: ContextType['navigate'] = (prefix, id?) => {
setPage({ prefix, id });
};
@@ -35,7 +35,7 @@ export const NavigationProvider: React.FC = ({ children }) => {
return <Provider value={navigation}>{children}</Provider>;
};
-export const useNavigate = () => {
+export const useNavigate = (): ContextType => {
return useContext(context);
};
diff --git a/src/pages/ProfilePage/ProfilePage.tsx b/src/pages/ProfilePage/ProfilePage.tsx
index ca39746..2c18466 100644
--- a/src/pages/ProfilePage/ProfilePage.tsx
+++ b/src/pages/ProfilePage/ProfilePage.tsx
@@ -16,7 +16,7 @@ const ProfilePage: React.FC = () => {
const { user } = useAuth();
useEffect(() => {
- const id = page?.id || user?._id
+ const id = page?.id || user?._id;
if (id) {
get(`/users/${id}`).then(response => {
setUserInfo(response.data);