Skip to content

Commit

Permalink
[#86] feat: add file for checking status & edit navigate url
Browse files Browse the repository at this point in the history
  • Loading branch information
suzinxix committed Mar 18, 2023
1 parent 9b3ca61 commit 1512294
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 30 deletions.
5 changes: 2 additions & 3 deletions bowwowcare/src/components/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import "../font.css";

import { ThemeContext } from './../context/ThemeProvider.js';
import { colorVariants } from '../utils/Dictionary';
import { isProfile } from '../utils/Status';

function Header() {
const [themeMode, setThemeMode] = useContext(ThemeContext);
Expand All @@ -29,10 +30,8 @@ function Header() {
}

const handleUser = (e) => {
navigate("user");
navigate("/user");
}

const isProfile = () => JSON.parse(localStorage.getItem("userImg"));

return (
<div>
Expand Down
3 changes: 1 addition & 2 deletions bowwowcare/src/context/ThemeProvider.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createContext, useState, useEffect } from "react";
import userService from "../services/user.service";
import { isLogin } from "../utils/isLogin";
import { isLogin } from "../utils/Status";

export const ThemeContext = createContext({});

Expand All @@ -9,7 +9,6 @@ function ThemeProvider({ children }) {
const [myTheme, setMyTheme] = useState(0);
const [ThemeMode, setThemeMode] = useState(theme[0]);


useEffect(() => {
if(isLogin()){
userService.getUserBoard().then((response) => {
Expand Down
23 changes: 0 additions & 23 deletions bowwowcare/src/theme/theme.js

This file was deleted.

2 changes: 2 additions & 0 deletions bowwowcare/src/utils/Status.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export const isLogin = () => !!localStorage.getItem("user");
export const isProfile = () => JSON.parse(localStorage.getItem("userImg"));
1 change: 0 additions & 1 deletion bowwowcare/src/utils/isLogin.js

This file was deleted.

2 changes: 1 addition & 1 deletion bowwowcare/src/views/HomePage/HomePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useNavigate } from "react-router-dom";
import axios from "axios";
import { API_URL } from "../../Config";
import authHeader from "../../services/auth-header";
import { isLogin } from "../../utils/isLogin";
import { isLogin } from "../../utils/Status";

import Header from "../../components/Header";
import PetList from "./PetList/PetList";
Expand Down

0 comments on commit 1512294

Please sign in to comment.