-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: 테이블 너비 수정 * feat: 관리자 로그인 추가 * feat: 태블릿 뷰 새로고침, 최근 번호 바로검색 구현 중 * fix: 최근 주문 10개 섹션과 주문 조회 섹션 합친 후 수정 --------- Co-authored-by: Yoo TaeSeung <remicon99@gmail.com>
- Loading branch information
1 parent
c71166f
commit 9c5762e
Showing
26 changed files
with
303 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { post } from "@apis/api"; | ||
import { useMutation } from "@tanstack/react-query"; | ||
import { ErrorResponse, CodeResponseType } from "@types"; | ||
import { useNavigate } from "react-router-dom"; | ||
|
||
interface LoginDataType { | ||
username: string; | ||
password: string; | ||
} | ||
|
||
const postAdminLogin = async ( | ||
loginData: LoginDataType | ||
): Promise<CodeResponseType> => { | ||
try { | ||
const response = await post<CodeResponseType>( | ||
`/api/v1/admin/authenticate`, | ||
loginData | ||
); | ||
return response.data; | ||
} catch (error) { | ||
const errorResponse = error as ErrorResponse; | ||
const errorData = errorResponse.response.data; | ||
throw errorData; | ||
} | ||
}; | ||
|
||
export const usePostAdminLogin = () => { | ||
const navigate = useNavigate(); | ||
return useMutation({ | ||
mutationFn: (loginData: LoginDataType) => postAdminLogin(loginData), | ||
onSuccess: (data) => { | ||
if (data.code === "success") { | ||
localStorage.setItem("accessToken", data.code); | ||
navigate("/admin"); | ||
} | ||
}, | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { Theme } from "@emotion/react"; | ||
import { css } from "@emotion/react"; | ||
import { flexGenerator } from "@styles/generator"; | ||
|
||
export const loginLayout = css` | ||
width: 100%; | ||
height: 100dvh; | ||
${flexGenerator()}; | ||
padding: 0 3rem; | ||
`; | ||
|
||
export const formStyle = css` | ||
width: 100%; | ||
${flexGenerator("column", "flex-start", "flex-start")} | ||
`; | ||
|
||
export const inputWrapper = css` | ||
width: 100%; | ||
${flexGenerator("column", "flex-start", "flex-start")} | ||
gap: 0.8rem; | ||
margin-bottom: 2rem; | ||
`; | ||
|
||
export const labelStyle = (theme: Theme) => css` | ||
${theme.font["head06-b-16"]}; | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { Button, Input } from "@components"; | ||
import { useState } from "react"; | ||
import { | ||
formStyle, | ||
inputWrapper, | ||
labelStyle, | ||
loginLayout, | ||
} from "./AdminLogin.style"; | ||
import { usePostAdminLogin } from "@apis/domains/admin/usePostAdminLogin"; | ||
|
||
const AdminLogin = () => { | ||
const [adminUsername, setAdminUsername] = useState(""); | ||
const [adminPw, setAdminPw] = useState(""); | ||
|
||
const { mutate } = usePostAdminLogin(); | ||
|
||
const handleUsernameChange = (e: React.ChangeEvent<HTMLInputElement>) => { | ||
setAdminUsername(e.target.value); | ||
}; | ||
|
||
const handlePwChange = (e: React.ChangeEvent<HTMLInputElement>) => { | ||
setAdminPw(e.target.value); | ||
}; | ||
|
||
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => { | ||
e.preventDefault(); | ||
mutate({ username: adminUsername, password: adminPw }); | ||
}; | ||
|
||
return ( | ||
<main css={loginLayout}> | ||
<form css={formStyle} onSubmit={handleSubmit}> | ||
<div css={inputWrapper}> | ||
<label htmlFor="adminUsername" css={labelStyle}> | ||
아이디 | ||
</label> | ||
<Input | ||
type="text" | ||
id="adminUsername" | ||
value={adminUsername} | ||
onChange={handleUsernameChange} | ||
/> | ||
</div> | ||
<div css={inputWrapper}> | ||
<label htmlFor="adminPw" css={labelStyle}> | ||
비밀번호 | ||
</label> | ||
<Input | ||
type="password" | ||
id="adminPw" | ||
value={adminPw} | ||
onChange={handlePwChange} | ||
/> | ||
</div> | ||
<Button type="button" variant="fill"> | ||
로그인 | ||
</Button> | ||
</form> | ||
</main> | ||
); | ||
}; | ||
|
||
export default AdminLogin; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import OrderCheck from "./AdminPage/OrderCheck/OrderCheck"; | ||
import ProductCheck from "./AdminPage/ProductCheck/ProductCheck"; | ||
import DeliveryCheck from "./AdminPage/DeliveryCheck/DeliveryCheck"; | ||
import AdminLogin from "./AdminLogin/AdminLogin"; | ||
|
||
export { OrderCheck, ProductCheck, DeliveryCheck, AdminLogin }; |
12 changes: 12 additions & 0 deletions
12
src/pages/orderCheck/components/OrderNumberSearchSection/OrderNumberSearchSection.style.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 0 additions & 14 deletions
14
src/pages/orderCheck/components/OrderTrackingSection/OrderTrackingSection.style.ts
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.