Skip to content

Commit

Permalink
feat: 받침대 db적용
Browse files Browse the repository at this point in the history
  • Loading branch information
5nxtnxtnxt committed Dec 1, 2023
1 parent 0ac90f7 commit 2b00c01
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
9 changes: 5 additions & 4 deletions front/src/components/SnowGlobeCanvas/SnowGlobeCanvas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const SnowGlobeCanvas = () => {
const glassRadius = 7;
const glassPosition = new THREE.Vector3(0, glassRadius / 2, 0);
const { snowBallData } = useContext(SnowBallContext); //컴포넌트인데 useContext사용해도 되나???
console.log(snowBallData, '!!!');
const snows = Array.from({ length: 100 }, (_, i) => (
<Models.Snow
key={i}
Expand Down Expand Up @@ -87,17 +88,17 @@ const SnowGlobeCanvas = () => {
opacity={0.08}
/>
<Models.MainDeco
id={0}
id={snowBallData.main_decoration_id}
scale={1}
position={new THREE.Vector3(0, 10, 0)}
color={new THREE.Color(snowBallData.main_decoration_color)}
/>
<Models.Bottom
bottomID={1}
bottomID={snowBallData.bottom_decoration_id}
scale={1}
position={new THREE.Vector3(0, 0, 0)}
title={'default'}
color={new THREE.Color('red')}
title={snowBallData.title}
color={new THREE.Color(snowBallData.bottom_decoration_color)}
/>
{snows}
{decos}
Expand Down
2 changes: 2 additions & 0 deletions front/src/mockdata.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"title": "title",
"main_decoration_id": 1,
"main_decoration_color": "#FFFFFF",
"bottom_decoration_id": 1,
"bottom_decoration_color": "#FFFFFF",
"is_message_private": true,
"message_list": []
},
Expand Down
4 changes: 2 additions & 2 deletions front/src/pages/Visit/SnowBallProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ interface SnowBallData {
is_message_private: boolean;
main_decoration_color: string;
main_decoration_id: number;
bottom_decoration_color: string;
bottom_decoration_id: number;
message_list: Array<Message>;
}
interface Message {
Expand Down Expand Up @@ -64,10 +66,8 @@ const SnowBallProvider: React.FC<{ children: React.ReactNode }> = ({
useEffect(() => {
axios(`/api/user/${user}`)
.then(res => {
console.log(res.data);
setSnowBallData(res.data.main_snowball as SnowBallData);
setUserData(res.data.user as UserData);
console.log(userData, '!!!!!!!!!');
})
.catch(e => {
//없는 유저 조회시 wrong page로 보내버리기
Expand Down

0 comments on commit 2b00c01

Please sign in to comment.