Skip to content

Commit

Permalink
Update useLoading title
Browse files Browse the repository at this point in the history
  • Loading branch information
Wysogota committed Aug 23, 2022
1 parent bc5c533 commit 77d21e9
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const SaveToRecommendation = () => {
formikBag.resetForm();
};

const loading = useLoading({ data: manga, isFetching, title: 'waiting...' });
const loading = useLoading({ data: manga, isFetching });
if (loading) return loading;

return (
Expand Down
2 changes: 1 addition & 1 deletion client/src/hooks/useLoading.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import MinorHeader from '../components/Headers/MinorHeader';
* @returns
*/
const useLoading = (options) => {
const { data, title = 'Waiting...', isFetching, spinner = true } = options;
const { data, title = '', isFetching, spinner = true } = options;

if (!spinner && isFetching) {
return <></>;
Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/Profile/ProfileLists.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const ProfileLists = () => {
'rounded mb-3',
);

const loading = useLoading({ data: listIds, isFethcing, title: 'waiting' });
const loading = useLoading({ data: listIds, isFethcing });
if (loading) return loading;

return (
Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/Profile/ProfileTabs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const {
const ProfileTabs = () => {
const { me, isFetching } = useSelector(({ me }) => me);

const loading = useLoading({ data: me, isFetching, title: 'wait', spinner: false });
const loading = useLoading({ data: me, isFetching, spinner: false });
if (loading) return loading;

return (
Expand Down
9 changes: 6 additions & 3 deletions client/src/pages/Profile/index.jsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
import React from 'react';
import { useSelector } from 'react-redux';
import { Container, Row, Button } from 'react-bootstrap';
import { Link } from 'react-router-dom';
import ColBlock from '../../components/Blocks/ColBlock';
import MainHeader from '../../components/Headers/MainHeader';
import Avatar from '../../components/Avatar';
import ProfileTabs from './ProfileTabs';
import { Link } from 'react-router-dom';
import { useLoading } from '../../hooks';
import CONSTANTS from '../../constants';
const { PAGES: { SETTINGS: { path: SETTINGS_PATH } } } = CONSTANTS;


const Profile = () => {
const { theme: { invertedColor } } = useSelector(({ themes }) => themes);
const { me } = useSelector(({ me }) => me);
const { me, isFetching } = useSelector(({ me }) => me);

const loading = useLoading({ data: me, isFetching });
if (loading) return loading;

return (
<Container>
Expand Down

0 comments on commit 77d21e9

Please sign in to comment.