Skip to content

Commit

Permalink
♻️ Refactor: 불필요한 token atom 삭제
Browse files Browse the repository at this point in the history
  • Loading branch information
sy-paik committed Oct 20, 2023
1 parent 7269c18 commit 8fa208f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import Following from '../../../components/common/User/Follow/Follow';
import Header from '../../../components/Header/TopListNavHeader';
import Footer from '../../../components/Footer/TabMenu';
import Loading from '../../../components/common/Loading/Loading';
import { tokenAtom } from '../../../atoms/UserAtom';
import { isDarkModeState } from '../../../atoms/StylesAtom';
import { getFollowingList } from '../../../api/follow';
import Logo from '../../../assets/images/home-logo.svg';
Expand All @@ -21,12 +20,13 @@ import {
} from '../FollowingListPage/FollowingListPageStyle';


const FollowingListPage = ({theme}) => {
const FollowingListPage = () => {
const account = useParams().id;
const isDarkMode = useRecoilValue(isDarkModeState);
const token = useRecoilValue(tokenAtom);
const token = localStorage.getItem('token');
const [isLoading, setIsLoading] = useState(true);
const [followings, setFollowings] = useState([]);

useEffect(() => {
const followList = async () => {
const data = await getFollowingList(account);
Expand Down
8 changes: 4 additions & 4 deletions src/pages/PostPage/PostPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { useRecoilValue } from 'recoil';
import JoinButton from '../../components/common/Button/ButtonContainer';
import Map from '../../components/Map/FeedMap';
import { isDarkModeState } from '../../atoms/StylesAtom';
import { tokenAtom } from '../../atoms/UserAtom';
import { postLike, deleteLike } from '../../api/post';
import basicImg from '../../assets/images/basic-profile-m.svg';
import basicDarkImg from '../../assets/images/basic-profile-m-dark.svg';
Expand All @@ -31,10 +30,11 @@ import {
} from './PostPageStyle';

const PostPage = ({ data, showModal }) => {

const isDarkMode = useRecoilValue(isDarkModeState);
const token = useRecoilValue(tokenAtom);
const [startPoint, setStartPoint] = useState(''); // startPoint 상태 추가
const [endPoint, setEndPoint] = useState(''); // endPoint 상태 추가
const token = localStorage.getItem('token');
const [startPoint, setStartPoint] = useState('');
const [endPoint, setEndPoint] = useState('');
const location = useLocation();
const navigate = useNavigate();
const [liked, setLiked] = useState(false);
Expand Down
5 changes: 2 additions & 3 deletions src/pages/SearchPage/SearchPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { useNavigate } from 'react-router-dom';
import Header from '../../components/Header/TopSearchNavHeader';
import TabMenu from '../../components/Footer/TabMenu';
import { isDarkModeState } from '../../atoms/StylesAtom';
import { tokenAtom } from '../../atoms/UserAtom';
import { getSearchResult } from '../../api/search'
import profileImg from '../../assets/images/basic-profile-m.svg';
import profileDarkImg from '../../assets/images/basic-profile-m-dark.svg';
Expand All @@ -20,9 +19,9 @@ import {
NickName,
} from './SearchPageStyle';

const SearchPage = ({theme}) => {
const SearchPage = () => {
const navigate = useNavigate();
const token = useRecoilValue(tokenAtom);
const token = localStorage.getItem('token');
const url = 'https://api.mandarin.weniv.co.kr';
const [data, setData] = useState([]);
const [search, setSearch] = useState('');
Expand Down
6 changes: 2 additions & 4 deletions src/pages/UploadPage/UploadPage.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { useEffect, useState } from 'react';
import { useNavigate } from 'react-router-dom';
import { useRecoilValue } from 'recoil';
import DatePicker from 'react-datepicker';
import 'react-datepicker/dist/react-datepicker.css';
import TimePicker from 'rc-time-picker';
Expand All @@ -12,7 +11,6 @@ import MapDrawingManager from '../../components/Map/MapDrawingManager';
import Map from '../../components/Map/FeedMap';
import Header from '../../components/Header/TopUploadHeader';
import Footer from '../../components/Footer/TabMenu';
import { tokenAtom } from '../../atoms/UserAtom';
import { postContentUpload, putEditPost } from '../../api/post';
import {
Container,
Expand All @@ -34,9 +32,9 @@ import {
List,
} from './UploadPageStyle';

const UploadPage = ({ editData, theme }) => {
const UploadPage = ({ editData }) => {
const navigate = useNavigate();
const userToken = useRecoilValue(tokenAtom);
const userToken = localStorage.getItem('token');
const [startDate, setStartDate] = useState(new Date());
const [time, setTime] = useState(moment());
const [text, setText] = useState('');
Expand Down

0 comments on commit 8fa208f

Please sign in to comment.