Skip to content

Commit

Permalink
design: Profile margin bottom 지정
Browse files Browse the repository at this point in the history
  • Loading branch information
MEGUMMY1 committed Jun 12, 2024
1 parent 0a9c1e1 commit b262112
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion atoms/userAtom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ interface AuthState {
user: User | null;
}

export const authState = atom<AuthState>({
export const authState = atom({
key: "authState",
default: {
isAuthenticated: false,
Expand Down
3 changes: 2 additions & 1 deletion components/Profile/Profile.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
max-width: 964px;
margin: 0 auto;
padding: 60px 0;
height: 395px;
height: auto;

@media (max-width: $TABLET) {
padding: 60px 32px;
Expand Down Expand Up @@ -38,6 +38,7 @@
justify-content: center;
text-align: center;
width: 100%;
margin-bottom: 30vh;

@media (max-width: $MOBILE) {
height: 195px;
Expand Down
13 changes: 10 additions & 3 deletions components/notice/CustomNoticeList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { calculateIncreasePercent } from "@/utils/calculateIncreasePercent";
import Link from "next/link";
import { useRecoilValue } from "recoil";
import { profileAtom } from "@/atoms/profileAtom";
import { authState, signupState } from "@/atoms/userAtom";

const cx = classNames.bind(styles);

Expand All @@ -22,6 +23,8 @@ const CustomNoticeList = () => {
const [postsPerPage, setPostsPerPage] = useState(3);
const isTablet = useResize(TABLET);
const userData = useRecoilValue(profileAtom);
const auth = useRecoilValue(authState);
const sign = useRecoilValue(signupState);
const userAddress = userData.area;

useEffect(() => {
Expand Down Expand Up @@ -50,8 +53,12 @@ const CustomNoticeList = () => {
useEffect(() => {
const loadNotices = async () => {
try {
//const data = await fetchNoticesByAddress(userAddress); 지역 선별 개선 필요
const data = await fetchNoticeList();
let data = [];
if (auth.isAuthenticated && sign.type === "employee") {
data = await fetchNoticesByAddress(userAddress);
} else {
data = await fetchNoticeList();
}
setNotices(data);
setLoading(false);
} catch (err) {
Expand All @@ -61,7 +68,7 @@ const CustomNoticeList = () => {
};

loadNotices();
}, [userAddress]);
}, [auth, userAddress]);

if (loading) {
return <Spinner />;
Expand Down

0 comments on commit b262112

Please sign in to comment.