Skip to content

Commit

Permalink
Fix: fix git merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
JSH99 committed Jan 23, 2024
2 parents 228820c + 1a64e9f commit 94a8b57
Show file tree
Hide file tree
Showing 154 changed files with 5,630 additions and 2,027 deletions.
21 changes: 12 additions & 9 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {QueryClient, QueryClientProvider} from '@tanstack/react-query';
import {Suspense} from 'react';
import {CookiesProvider} from 'react-cookie';
import {DndProvider} from 'react-dnd';
import {HTML5Backend} from 'react-dnd-html5-backend';
Expand All @@ -11,15 +12,17 @@ import MainRouter from './routes/MainRouter/MainRouter';
const queryClient = new QueryClient();
function App() {
return (
<QueryClientProvider client={queryClient}>
<CookiesProvider>
<DndProvider backend={HTML5Backend}>
<BrowserRouter>
<MainRouter />
</BrowserRouter>
</DndProvider>
</CookiesProvider>
</QueryClientProvider>
<Suspense fallback='서스펜스 로딩입니다, 추후에 폴백UI를 추가하거나 아니면 지우겠습니다~~'>
<QueryClientProvider client={queryClient}>
<CookiesProvider>
<DndProvider backend={HTML5Backend}>
<BrowserRouter>
<MainRouter />
</BrowserRouter>
</DndProvider>
</CookiesProvider>
</QueryClientProvider>
</Suspense>
);
}

Expand Down
27 changes: 27 additions & 0 deletions src/api/search.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import axios from 'axios';

import {SearchItemType} from '@/types/home';

export async function getSearchData(
page: number,
areaCode: number,
sigunguCode: number,
placeTypeId: number,
keyword: string,
sort: string,
categoryCode: string,
) {
const searchData: SearchItemType = await axios.get('/api/places/search', {
params: {
page: page,
size: 20,
areaCode: areaCode,
sigunguCode: sigunguCode,
placeTypeId: placeTypeId,
keyword: keyword,
sort: sort,
categoryCode: categoryCode,
},
});
return searchData;
}
81 changes: 69 additions & 12 deletions src/api/vote.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,86 @@
import axios from 'axios';

import {postTaglineProps, postVoteTitleProps, VoteListInfo} from '@/types/vote';
import {
DeleteCandidatesProps,
EditVoteTitleProps,
PostNewCandidateProps,
PostVoteTitleProps,
VoteInfo,
VoteListInfo,
} from '@/types/vote';

//단일vote
export const getVoteInfo = async (voteId: string) => {
/* ----------------------------------- G E T ---------------------------------- */

//단일 보트
export const getVoteInfo = async (voteId: number): Promise<VoteInfo> => {
const response = await axios.get(`/api/votes/${voteId}`);
return response.data.data;
return response.data;
};

//voteList in space
export const getVoteListInfo = async (spaceId: string): Promise<VoteListInfo> => {
//보트 리스트
export const getVoteListInfo = async (spaceId: number): Promise<VoteListInfo[]> => {
const response = await axios.get(`/api/votes/${spaceId}`);
return response.data.data;
return response.data;
};

//getVotesResults

/* ----------------------------------- P O S T ---------------------------------- */

//vote 추가
export const PostNewVote = async ({spaceId, title}: postVoteTitleProps): Promise<void> => {
const response = await axios.post('/api/votes', {params: {spaceId, title}});
return response.data;
export const PostNewVote = async ({spaceId, title}: PostVoteTitleProps) => {
try {
const response = await axios.post('/api/votes', {spaceId, title});
console.log('axios 포스트 성공', response);
return response;
} catch (error) {
console.error(error);
}
};

//후보 메모 후 추가
export const postTagline = async ({voteId, placeId, tagline}: postTaglineProps) => {
const response = await axios.post(`/api/votes/${voteId}`, {params: {placeId, tagline}});
export const postNewCandidate = async ({voteId, candidates}: PostNewCandidateProps) => {
const response = await axios.post(`/api/votes/${voteId}`, {params: candidates});
return response.data;
};

/* ----------------------------------- P U T ---------------------------------- */

//voteTitle 수정 PUT - api미정
export const editVoteTitle = async ({title, voteId}: EditVoteTitleProps) => {
try {
const response = await axios.put(`/api/votes/${voteId}`, {params: title});
return response.data;
} catch (error) {
console.error(error);
}
};

/* ----------------------------------- D E L E T E ---------------------------------- */

//votes/{voteId} vote 삭제
export const deleteVote = async (voteId: number) => {
try {
const response = await axios.delete(`/api/votes/${voteId}`);
return response.data;
} catch (error) {
console.error(error);
}
};

//msw 돌려야함
//candidate 삭제- api 미정 / candidateId:number[] 여러아이디 배열에 담음
export const deleteCandidates = async ({voteId, candidateId}: DeleteCandidatesProps) => {
try {
const response = await axios.delete(`/api/votes/${voteId}/candidates/${candidateId}`);
return response.data;
} catch (error) {
console.error(error);
}
};

///votes/{voteId}/candidates candidate메모와 함께 추가 POST

//votes/{voteId}/candidates/{candidatesId} 별 투표하기 POST -> + DELETE 투표 삭제?

//PUT 투표 상태 변경(재진행) -> ?
3 changes: 3 additions & 0 deletions src/assets/homeIcons/search/nullImg.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions src/assets/icons/crying_imoji.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions src/assets/icons/error-warning-line.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/assets/icons/mapPin.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/assets/icons/meatball.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/assets/icons/pencil.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/assets/icons/pencil_with_line.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/assets/icons/star.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/assets/icons/star_fill.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/icons/tooltipFrame.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/assets/icons/trash_icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 11 additions & 1 deletion src/chakra/modalCustom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ export const modalTheme = defineMultiStyleConfig({
baseStyle,
variants: {alertModal},
sizes: {
addVote: {dialog: {w: '100%', maxW: '41rem', mx: '24px'}},
addVote: { dialog: { w: "100%", maxW: "41rem", mx: "24px" } },
imageModal: {
dialog: {
w: "100%",
maxW: "45rem",
height: "100%",
my: 0,
bg: "#0A0D14",
},

},
},
});
4 changes: 4 additions & 0 deletions src/components/Auth/Input/Input.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,8 @@
margin-top: 2px;
margin-bottom: 12px;
}

.removeBtn {
top: 81px;
}
}
39 changes: 39 additions & 0 deletions src/components/Auth/Input/InputOldPassword.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import styles from "./Input.module.scss";

import validationForm from "@/utils/inputValidation";

import { InputOldPasswordProps } from "@/types/auth";

function InputOldPassword({
register,
dirtyFields,
errors,
}: InputOldPasswordProps) {
return (
<section className={styles.password}>
<label htmlFor="oldPassword">비밀번호</label>

<input
id="password"
type="password"
className={`${styles.input} ${
dirtyFields?.oldPassword && errors?.oldPassword ? styles.error : ""
}`}
placeholder="영문, 숫자, 특수문자 포함 8자 이상"
{...register("oldPassword", {
required: true,
pattern: {
value: validationForm.password,
message: "비밀번호 형식이 올바르지 않습니다.",
},
})}
/>

{!dirtyFields?.oldPassword || errors?.oldPassword ? (
<small>{errors?.oldPassword?.message}</small>
) : null}
</section>
);
}

export default InputOldPassword;
12 changes: 8 additions & 4 deletions src/components/Auth/Login/LoginForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,14 @@ function LoginForm() {
if (showError(email as string, password as string)) return;

try {
const res = await axios.post("/api/login", {
email,
password,
});
const res = await axios.post(
"/api/login",
{
email,
password,
},
{ withCredentials: true },
);
console.log(res.data);

navigate("/", { replace: true });
Expand Down
10 changes: 10 additions & 0 deletions src/components/Auth/ModifyPassword/ModifyPasswordForm.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@use "@/sass" as *;

.container {
position: relative;
color: $neutral900;

h2 {
@include typography(headline);
}
}
71 changes: 71 additions & 0 deletions src/components/Auth/ModifyPassword/ModifyPasswordForm.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import axios from "axios";
import { useState } from "react";
import { useForm } from "react-hook-form";

import styles from "./ModifyPasswordForm.module.scss";

import StepNewPassword from "./Step/StepNewPassword";
import StepOldPassword from "./Step/StepOldPassword";

import { AuthForm } from "@/types/auth";

function ModifyPasswordForm() {
const {
register,
resetField,
handleSubmit,
watch,
formState: { errors, dirtyFields },
} = useForm<AuthForm>({
mode: "onChange",
defaultValues: {
oldPassword: "",
password: "",
passwordConfirm: "",
},
});
const watchFields = watch();

// steps : oldPassword, newPassword
const [step, setStep] = useState("oldPassword");
const [token, setToken] = useState("");

const onSubmit = async () => {
try {
const res = axios.post("/api/auth/modify/password", {
token,
newPassword: watchFields.password,
});

console.log(res);
} catch (error) {
console.log(error);
}
};

return (
<form className={styles.container} onSubmit={handleSubmit(onSubmit)}>
{step === "oldPassword" && (
<StepOldPassword
setToken={setToken}
register={register}
dirtyFields={dirtyFields}
errors={errors}
setStep={setStep}
/>
)}

{step === "newPassword" && (
<StepNewPassword
register={register}
resetField={resetField}
watchFields={watchFields}
dirtyFields={dirtyFields}
errors={errors}
/>
)}
</form>
);
}

export default ModifyPasswordForm;
Loading

0 comments on commit 94a8b57

Please sign in to comment.