Skip to content

Commit

Permalink
Merge pull request #25 from dorongee/feat/#24-complete
Browse files Browse the repository at this point in the history
Feat/#24 complete
  • Loading branch information
bae-sh authored Nov 30, 2023
2 parents 8fdbdd4 + f35cc28 commit 21352cb
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
8 changes: 5 additions & 3 deletions frontend/src/components/village/VillageContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { UserItem, UserProfile, Village } from '../../types';
import { getVillageAll } from '../../service/village';
import { checkVillageDistance } from '../../app/util';
import { PositionContext } from '../../app/layout';
import { NORMAL_IMG_KEY, USER_ID_KEY } from '../../constants';

export default function VillageContainer() {
const [toggleStart, setToggleStart] = useState(false);
Expand All @@ -24,8 +25,9 @@ export default function VillageContainer() {

useEffect(() => {
(async () => {
const profile = getUserProfile(1);
const items = getUserItems(1);
const userId = Number(sessionStorage.getItem(USER_ID_KEY));
const profile = getUserProfile(userId);
const items = getUserItems(userId);
Promise.all([profile, items]).then((res) => {
setUserProfile(res[0]);
setUserItems(res[1]);
Expand Down Expand Up @@ -80,7 +82,7 @@ export default function VillageContainer() {
<div className="flex gap-[16px] w-full justify-center pt-[24px]">
<div className="w-[156px] relative">
<Image
src="/images/avatar.png"
src={sessionStorage.getItem(NORMAL_IMG_KEY)}
alt="main-map"
width={80}
height={377}
Expand Down
11 changes: 10 additions & 1 deletion frontend/src/components/village/VillageDetailContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ import { useRouter } from 'next/navigation';
import { getVillage } from '../../service/village';
import { PositionContext } from '../../app/layout';
import { checkVillageDistance } from '../../app/util';
import {
CHEERING_IMG_KEY,
DESPAIR_IMG_KEY,
NORMAL_IMG_KEY,
} from '../../constants';

type Props = {
missions: Mission[];
Expand Down Expand Up @@ -177,7 +182,11 @@ export default function VillageDetailContainer({
{clickedType === 'O' ? '성공!' : '다시 시도해볼까요?'}
</p>
<Image
src={exampleImg}
src={
clickedType === 'O'
? sessionStorage.getItem(CHEERING_IMG_KEY)
: sessionStorage.getItem(DESPAIR_IMG_KEY)
}
width={176}
height={176}
alt="example"
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,4 @@ export const USER_ID_KEY = 'userId';

export const MAX_IMAGE_BYTE = 5242880;

export const SERVER_ADDRESS = 'https://k2ab4a8a87c19a.user-app.krampoline.com';
export const SERVER_ADDRESS = '/api';

0 comments on commit 21352cb

Please sign in to comment.