-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from the-kingdoms/develop
Feat: Develop
- Loading branch information
Showing
36 changed files
with
1,407 additions
and
647 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,3 +21,5 @@ | |
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
.env |
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 |
---|---|---|
|
@@ -17,15 +17,19 @@ | |
"@types/react": "^18.3.3", | ||
"@types/react-dom": "^18.3.0", | ||
"dayjs": "^1.11.12", | ||
"dotenv": "^16.4.5", | ||
"electron-is-dev": "^3.0.1", | ||
"framer-motion": "^11.3.30", | ||
"jotai": "^2.9.0", | ||
"jotai-devtools": "^0.10.0", | ||
"react": "^18.3.1", | ||
"react-dom": "^18.3.1", | ||
"react-loading-indicators": "^1.0.0", | ||
"react-router-dom": "^6.25.1", | ||
"react-scripts": "5.0.1", | ||
"styled-components": "^6.1.12", | ||
"typescript": "^4.9.5", | ||
"use-sound": "^4.0.3", | ||
"web-vitals": "^2.1.4" | ||
}, | ||
"scripts": { | ||
|
@@ -62,5 +66,6 @@ | |
"electron": "^31.2.1", | ||
"electron-builder": "^24.13.3", | ||
"wait-on": "^7.2.0" | ||
} | ||
}, | ||
"packageManager": "[email protected]" | ||
} |
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,18 @@ | ||
import api from './network' | ||
|
||
interface PostLoginResponse { | ||
token: string | ||
} | ||
|
||
export interface PostKakaoLoginBody { | ||
code: string | ||
state: string | ||
redirectUri: string | ||
} | ||
|
||
async function postKakaoLogin(body: PostKakaoLoginBody): Promise<PostLoginResponse> { | ||
const { data } = await api.post(`/api/login/kakao`, body) | ||
return data | ||
} | ||
|
||
export { postKakaoLogin } |
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,48 @@ | ||
import api from './network' | ||
|
||
type RoleType = 'OWNER' | 'MANAGER' | 'STAFF' | ||
type DayType = 'Monday' | 'Tuesday' | 'Wednesday' | 'Thursday' | 'Friday' | 'Saturday' | 'Sunday' | ||
|
||
interface AbstractMember { | ||
id: string | null | ||
name: string | null | ||
phone: string | null | ||
providerType: 'KAKAO' | null | ||
storeList: Store[] | ||
} | ||
|
||
interface My extends AbstractMember { | ||
relationList: Relation[] | ||
} | ||
|
||
interface Relation { | ||
id: string | ||
storeId: string | ||
member: AbstractMember | ||
planList: Plan[] | ||
role: RoleType | ||
position: string | ||
} | ||
|
||
interface Plan { | ||
id: string | ||
relationId: string | ||
day: DayType | ||
startTime: string | ||
endTime: string | ||
restStartTime: string | ||
restEndTime: string | ||
} | ||
|
||
interface Store { | ||
storeId: string | ||
name: string | ||
} | ||
|
||
async function getMy(): Promise<My> { | ||
const { data } = await api.get<My>(`/api/my`) | ||
return data | ||
} | ||
|
||
export { getMy } | ||
export type { My } |
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,42 @@ | ||
import axios from 'axios' | ||
|
||
const setTokenFromLocalStorage = (access_token: string) => { | ||
localStorage.setItem('access_token', access_token) | ||
} | ||
|
||
const getTokenFromLocalStorage = () => { | ||
const accessToken = localStorage.getItem('access_token') | ||
if (!accessToken) return null | ||
|
||
return accessToken | ||
} | ||
|
||
const eollugageUrl = process.env.REACT_APP_API_URL | ||
|
||
const api = axios.create({ | ||
baseURL: eollugageUrl, | ||
headers: { | ||
'Content-Type': 'application/json;charset=UTF-8', | ||
Accept: 'application/json', | ||
'Access-Control-Allow-Origin': 'http://localhost:3000', | ||
'Access-Control-Allow-Credentials': 'true', | ||
}, | ||
validateStatus: status => { | ||
return status < 300 | ||
}, | ||
}) | ||
api.interceptors.request.use( | ||
async config => { | ||
if (typeof document !== 'undefined') { | ||
const token = getTokenFromLocalStorage() | ||
config.headers.set('Authorization', `Bearer ${token}`) | ||
} | ||
return config | ||
}, | ||
error => { | ||
return Promise.reject(error) | ||
}, | ||
) | ||
|
||
export default api | ||
export { setTokenFromLocalStorage, getTokenFromLocalStorage } |
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,46 @@ | ||
import api from './network' | ||
|
||
export interface PaymentHistory { | ||
paymentHistoryId: string | ||
storeId: string | ||
tableNumber: number | ||
status: PaymentHistoryStatus | ||
paidAt: null | ||
totalPrice: number | ||
orderHistoryResponseDtoList: OrderHistory[] | ||
} | ||
|
||
export interface OrderHistory { | ||
orderHistoryId: string | ||
paymentHistoryId: string | ||
orderDetail: string | ||
totalPrice: number | ||
createdAt: string | ||
updatedAt: string | null | ||
status: OrderHistoryStatus | ||
} | ||
|
||
type PaymentHistoryStatus = 'WAITING' | 'PROCESS' | 'HISTORY' | ||
type OrderHistoryStatus = 'APPROVED' | 'PENDING' | 'DISAPPROVED' | 'HISTORY' | ||
|
||
async function getPaymentHistory(storeId: string, status?: string, filter: string = 'ALL'): Promise<PaymentHistory[]> { | ||
const statusQuery = status ? `&status=${status}` : '' | ||
const { data } = await api.get(`/api/v1/stores/${storeId}/payment-histories?filter=${filter}${statusQuery}`) | ||
return data | ||
} | ||
|
||
async function patchPaymentHistory( | ||
storeId: string, | ||
paymentHistoryId: string, | ||
orderHistoryId: string, | ||
status: string, | ||
): Promise<PaymentHistory[]> { | ||
const body = { status } | ||
const { data } = await api.patch( | ||
`/api/v1/stores/${storeId}/payment-histories/${paymentHistoryId}/order-histories/${orderHistoryId}`, | ||
body, | ||
) | ||
return data | ||
} | ||
|
||
export { getPaymentHistory, patchPaymentHistory } |
Binary file not shown.
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,30 @@ | ||
import styled from 'styled-components' | ||
import { createRandomString } from 'utils/createRandomId' | ||
|
||
export default function KakaoButton() { | ||
const redirectUri = `${window.location.origin}/oauth` | ||
const onClickLogin = () => { | ||
window.location.href = `https://kauth.kakao.com/oauth/authorize?redirect_uri=${redirectUri}&client_id=${ | ||
process.env.REACT_APP_KAKAO_REST_KEY | ||
}&response_type=code&state=${createRandomString(8)}` | ||
} | ||
|
||
return ( | ||
<KakaoLoginButton onClick={onClickLogin}> | ||
<img src={require('assets/image/kakao.png')} width={24} height={24} alt="kakao-login-button" /> | ||
카카오 로그인 | ||
</KakaoLoginButton> | ||
) | ||
} | ||
|
||
const KakaoLoginButton = styled.div` | ||
background-color: #fee500; | ||
width: 328px; | ||
border-radius: 1000px; | ||
padding: 20px 0; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
gap: 8px; | ||
cursor: pointer; | ||
` |
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
Oops, something went wrong.