Skip to content

Commit

Permalink
Merge pull request #3 from shimdokite/guest
Browse files Browse the repository at this point in the history
[FE] ♻️ 게스트 모드 리팩토링
  • Loading branch information
shimdokite authored Mar 20, 2024
2 parents adb4cd5 + 13ff818 commit 8bd60c3
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 22 deletions.
28 changes: 19 additions & 9 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"@material-tailwind/react": "^2.1.1",
"@stomp/stompjs": "^7.0.0",
"@tanstack/react-query": "^4.33.0",
"@types/axios": "^0.14.0",
"@types/node": "20.5.7",
"@types/react": "18.2.21",
"@types/react-dom": "18.2.7",
Expand All @@ -36,6 +35,7 @@
"zustand": "^4.4.1"
},
"devDependencies": {
"@types/axios": "^0.14.0",
"@types/lodash": "^4.14.197",
"@types/sockjs-client": "^1.5.4",
"@typescript-eslint/eslint-plugin": "^6.5.0",
Expand Down
8 changes: 0 additions & 8 deletions client/src/api/guest.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
import axios from 'axios';

import { instance } from './axios';

const url = process.env.NEXT_PUBLIC_API_URL;

export const postCreateGuest = async () => {
const response = await axios.post(`${url}/accounts/guest`);

return response;
};

export const deleteGuestMode = async () => {
const response = await instance.delete(`${url}/accounts`);

return response;
};
1 change: 0 additions & 1 deletion client/src/app/garden/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import {
EmptyInventoryModal,
GuestbookModal,
} from '@/components/garden';
import { NotificationButton } from '@/components/common';

import { InquiryButton } from '@/components/inquiry';

Expand Down
1 change: 0 additions & 1 deletion client/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import ScrollDownButton from '@/components/main/ScrollDownButton';
import { InquiryButton } from '@/components/inquiry';

import { getScrollTop } from '@/utils/getScrollTop';
import { NotificationButton } from '@/components/common';

export default function Home() {
const isClient = useClient();
Expand Down
1 change: 1 addition & 0 deletions client/src/components/signin/LoginButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export default function LoginButtion() {

const goToGoogleLogin = () => {
router.push(`${googleOauth}`);

onGoogleLogin;
};

Expand Down
2 changes: 1 addition & 1 deletion client/src/hooks/mutation/useCreateGuestMutation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const useCreateGuestMutation = () => {
mutationFn: () => postCreateGuest(),

onSuccess: (data) => {
const userId = data.headers.location.slice(-3);
const userId = data.headers.location.match(/\/(\d+)/)[1];
const accessToken = data.headers.authorization;
const refreshToken = data.headers.refresh;
const displayName = `게스트 ${userId}`;
Expand Down
2 changes: 2 additions & 0 deletions client/src/hooks/mutation/useDeleteGuestMutation.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useRouter } from 'next/navigation';

import { useMutation } from '@tanstack/react-query';

import { deleteUser } from '@/api/history';
Expand All @@ -15,6 +16,7 @@ const useDeleteGuestMutation = () => {

onSuccess: () => {
setClear();

router.push('/');
},
});
Expand Down
1 change: 0 additions & 1 deletion client/src/stores/userStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ interface UserInfo {
interface User extends UserInfo {
setGoogleUser: (userInfo: UserInfo) => void;
setEmailUser: (userInfo: UserInfo) => void;

setGuestMode: (userInfo: UserInfo) => void;

setProfileImageUrl: (profileImageUrl: string) => void;
Expand Down

0 comments on commit 8bd60c3

Please sign in to comment.