Skip to content

Commit

Permalink
Merge pull request #204 from DumakIt/#199_map_refactor
Browse files Browse the repository at this point in the history
#199 map refactor
  • Loading branch information
DumakIt authored Apr 14, 2023
2 parents f45a420 + 674437d commit 3bbe332
Show file tree
Hide file tree
Showing 34 changed files with 1,203 additions and 1,365 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ module.exports = {
},
plugins: ["react"],
rules: {
"@typescript-eslint/restrict-template-expressions": "off",
"react/react-in-jsx-scope": "off",
"@typescript-eslint/consistent-type-imports": "off",
"@typescript-eslint/naming-convention": "off",
Expand Down
17 changes: 17 additions & 0 deletions pages/eatsMe/routeWrite/[boardId]/index.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,37 @@
import { useQuery } from "@apollo/client";
import { useEffect } from "react";
import { useRecoilState } from "recoil";
import {
infoWindowClickState,
pathState,
} from "../../../../src/commons/stores";
import {
IQuery,
IQueryFetchBoardArgs,
} from "../../../../src/commons/types/generated/types";
import { useFetchDataSet } from "../../../../src/components/commons/hooks/custom/useFetchDataSet";
import { useRouterIdCheck } from "../../../../src/components/commons/hooks/custom/useRouterIdCheck";
import { useWithAuth } from "../../../../src/components/commons/hooks/custom/useWithAuth";
import { FETCH_BOARD } from "../../../../src/components/commons/hooks/query/useQueryFetchBoard";
import RouteWrite from "../../../../src/components/units/eatsMe/routeWrite/routeWrite";

export default function RouteUpdatePage(): JSX.Element {
useWithAuth();
const [, setPath] = useRecoilState(pathState);
const [, setInfoWindowClick] = useRecoilState(infoWindowClickState);
const { fetchDataSet } = useFetchDataSet();
const { id } = useRouterIdCheck("boardId");
const { data } = useQuery<Pick<IQuery, "fetchBoard">, IQueryFetchBoardArgs>(
FETCH_BOARD,
{ variables: { boardId: id } }
);

useEffect(() => {
if (data !== undefined) {
fetchDataSet({ setPath, setInfoWindowClick, data: data.fetchBoard });
}
}, [data]);

return (
<>
<RouteWrite isEdit={true} data={data} />
Expand Down
2 changes: 1 addition & 1 deletion pages/eatsMe/routeWrite/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import { useWithAuth } from "../../../src/components/commons/hooks/custom/useWit
import RouteWrite from "../../../src/components/units/eatsMe/routeWrite/routeWrite";

export default function RouteWritePage(): JSX.Element {
useWithAuth();
// useWithAuth();
return <RouteWrite isEdit={false} />;
}
9 changes: 3 additions & 6 deletions src/commons/libraries/getNewAccessToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,9 @@ const RESTORE_ACCESS_TOKEN = gql`

export const getNewAccessToken = async (): Promise<string | undefined> => {
try {
const graphQLClient = new GraphQLClient(
"https://jjjbackendclass.shop/graphql",
{
credentials: "include",
}
);
const graphQLClient = new GraphQLClient("https://sit-woo.store/graphql", {
credentials: "include",
});

const result = await graphQLClient.request<
Pick<IMutation, "restoreAccessToken">
Expand Down
119 changes: 119 additions & 0 deletions src/commons/stores/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,122 @@ export const boardIdState = atom({
key: "boardIdState",
default: "",
});

export const infoWindowClickState = atom({
key: "infoWindowClickState",
default: 0,
dangerouslyAllowMutability: true,
});

export const mapState = atom({
key: "mapState",
default: {} as any,
dangerouslyAllowMutability: true,
});

export const markerState = atom({
key: "markerState",
default: [] as any,
dangerouslyAllowMutability: true,
});

export const pickMarkerState = atom({
key: "pickMarkerState",
default: [] as any,
dangerouslyAllowMutability: true,
});

export const infoWindowState = atom({
key: "infoWindowState",
default: [] as any,
dangerouslyAllowMutability: true,
});

export const findLineState = atom({
key: "findLineState",
default: [] as any,
dangerouslyAllowMutability: true,
});

export const slideSettingState = atom({
key: "slideSettingState",
dangerouslyAllowMutability: true,
default: {
keyword: ["", "", "", "", "", ""],
nowPage: 0,
isActive: true,
disabled_next: true,
disabled_prev: true,
},
});

export const pathState = atom({
key: "pathState",
dangerouslyAllowMutability: true,
default: {
title: "",
boardImg: "",
startArea: "",
endArea: "",
startPoint: "",
endPoint: "",
like: 0,
info: [
{
restaurantName: "상호명",
recommend: "",
imgUrl: "",
section: "",
area: "",
location: {
lat: 0,
lng: 0,
},
},
{
restaurantName: "상호명",
recommend: "",
imgUrl: "",
section: "",
area: "",
location: {
lat: 0,
lng: 0,
},
},
{
restaurantName: "상호명",
recommend: "",
imgUrl: "",
section: "",
area: "",
location: {
lat: 0,
lng: 0,
},
},
{
restaurantName: "상호명",
recommend: "",
imgUrl: "",
section: "",
area: "",
location: {
lat: 0,
lng: 0,
},
},
{
restaurantName: "상호명",
recommend: "",
imgUrl: "",
section: "",
area: "",
location: {
lat: 0,
lng: 0,
},
},
],
} as any,
});
2 changes: 1 addition & 1 deletion src/components/commons/apollo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default function ApolloSetting(props: IApolloSettingProps): JSX.Element {
});

const uploadLink = createUploadLink({
uri: "https://jjjbackendclass.shop/graphql",
uri: "https://sit-woo.store/graphql",
headers: {
Authorization: `Bearer ${accessToken}`,
},
Expand Down
112 changes: 0 additions & 112 deletions src/components/commons/hooks/custom/useClickInfoWindow.ts

This file was deleted.

Loading

0 comments on commit 3bbe332

Please sign in to comment.