Skip to content

Commit

Permalink
Deploy (#361)
Browse files Browse the repository at this point in the history
Co-authored-by: 송현우 <[email protected]>
Co-authored-by: 이아론 <[email protected]>
Co-authored-by: 정태관 <[email protected]>
Co-authored-by: 태윤 <[email protected]>
  • Loading branch information
5 people authored Aug 19, 2024
1 parent b03ce32 commit 7523b62
Show file tree
Hide file tree
Showing 263 changed files with 13,468 additions and 11,804 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ root = true
# 모든 파일에 적용
[*]
end_of_line = lf
insert_final_newline = false
insert_final_newline = true
charset = utf-8
indent_size = 2
indent_style = tab
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/SMS-app-CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 9.1.2
version: 9.4.0

- run: |
touch packages/app/.env.local
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/SMS-shared-CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 9.1.2
version: 9.4.0

- run: pnpm i --frozen-lockfile
- run: pnpm build:shared
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.13.0
20
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@sms",
"version": "1.0.0",
"private": true,
"packageManager": "pnpm@9.1.2",
"packageManager": "pnpm@9.4.0",
"scripts": {
"format": "prettier --check --cache **/*.{tsx,ts}",
"eslint": "eslint --cache **/*.{tsx,ts}",
Expand Down Expand Up @@ -45,4 +45,4 @@
"storybook": "^7.4.0",
"typescript": "^5.0.4"
}
}
}
13 changes: 6 additions & 7 deletions packages/app/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@ const nextConfig = {
formats: ['image/avif', 'image/webp'],
domains: [process.env.IMAGE_SERVER_DOMAIN],
},
async rewrites() {
return [
{
source: '/server/:path*', // 프론트엔드에서 요청하는 경로에 대한 리다이렉트
destination: `${process.env.SERVER_URL}/:path*`, // 백엔드 도메인
},
]
webpack: (config, { _isServer }) => {
config.module.rules.push({
test: /\.pdf$/,
use: 'file-loader',
})
return config
},
}

Expand Down
13 changes: 9 additions & 4 deletions packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,38 @@
"dependencies": {
"@emotion/react": "^11.10.6",
"@emotion/styled": "^11.10.6",
"@hookform/error-message": "^2.0.1",
"@hookform/resolvers": "^3.4.2",
"@reduxjs/toolkit": "^1.9.3",
"@sms/shared": "workspace:*",
"@tanstack/react-query": "^5.37.1",
"axios": "^1.3.5",
"axios-retry": "^3.7.0",
"cookies": "^0.9.1",
"file-saver": "^2.0.5",
"jsonwebtoken": "^9.0.1",
"formidable": "^3.5.1",
"jsonwebtoken": "^9.0.2",
"lottie-web": "^5.12.2",
"next": "13.3.0",
"next-redux-wrapper": "^8.1.0",
"next": "13.5.6",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-hook-form": "^7.43.9",
"react-pdf": "^8.0.2",
"react-redux": "^8.0.5",
"sharp": "^0.32.5",
"zod": "^3.23.8"
},
"devDependencies": {
"@next/bundle-analyzer": "^13.5.2",
"@types/cookies": "^0.9.0",
"@types/file-saver": "^2.0.5",
"@types/formidable": "^3.4.5",
"@types/jsonwebtoken": "^9.0.2",
"@types/node": "^18.15.11",
"@types/qs": "^6.9.7",
"@types/react": "^18.0.33",
"@types/react-dom": "^18.0.11",
"cross-env": "^7.0.3",
"file-loader": "^6.2.0",
"typescript": "^5.0.4"
}
}
19 changes: 0 additions & 19 deletions packages/app/src/api/axiosApi.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,10 @@
import axios from 'axios'
import qs from 'qs'
import ParamsFilter from '@lib/ParamsFilter'
import axiosRetry from 'axios-retry'

const axiosApi = axios.create({
'axios-retry': {
retries: 3,
retryCondition: (e) => e.response?.status === 401,
},
paramsSerializer: (params) =>
qs.stringify(ParamsFilter(params), { arrayFormat: 'repeat' }),
})

axiosRetry(axiosApi, {
retries: 3,
retryDelay: (retryCount) => {
return retryCount * 1000
},
shouldResetTimeout: true,
retryCondition: (error) => {
return (
axiosRetry.isNetworkOrIdempotentRequestError(error) ||
error.response?.status === 401
)
},
})

export default axiosApi
1 change: 0 additions & 1 deletion packages/app/src/api/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export { default as axiosApi } from './axiosApi'
export { default as rtkApi } from './rtkApi'
10 changes: 0 additions & 10 deletions packages/app/src/api/rtkApi.ts

This file was deleted.

3 changes: 3 additions & 0 deletions packages/app/src/features/auth/dtos/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export { default as LoggedInResDto } from './res/LoggedInResDto'

export type { LoggedInResType } from './res/LoggedInResDto'
26 changes: 26 additions & 0 deletions packages/app/src/features/auth/dtos/res/LoggedInResDto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { z } from 'zod'
import Role from '@/types/Role'

const RoleSchema = z.enum([
Role.ROLE_STUDENT,
Role.ROLE_TEACHER,
Role.ROLE_DIRECTOR,
Role.ROLE_HOMEROOM,
Role.ROLE_PRINCIPAL,
Role.ROLE_DEPUTY_PRINCIPAL,
])

export const successDto = z.object({
isLoggedIn: z.literal(true),
role: RoleSchema,
})

export const failDto = z.object({
isLoggedIn: z.literal(false),
})

const LoggedInResDto = z.discriminatedUnion('isLoggedIn', [successDto, failDto])

export type LoggedInResType = z.infer<typeof LoggedInResDto>

export default LoggedInResDto
6 changes: 0 additions & 6 deletions packages/app/src/features/auth/hook/useAuth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,13 @@ import env from '@lib/env'
import { useEffect } from 'react'
import login from '@features/auth/service/login'
import { useToast } from '@features/toast'
import useLocalStorage from '@features/global/hooks/useLocalStorage'
import Token from '@lib/Token'
import useLoading from '@features/modal/hooks/useLoading'

const useAuth = () => {
const router = useRouter()
const code = router.query.code?.toString() || ''
const { addToast } = useToast()
const { loadingWrap, loadingClose } = useLoading()
const [_, setAccessExpires] = useLocalStorage(Token.ACCESS_TOKEN_EXP, '')
const [__, setRefreshExpires] = useLocalStorage(Token.REFRESH_TOKEN_EXP, '')

useEffect(() => {
if (!code) return
Expand All @@ -25,8 +21,6 @@ const useAuth = () => {
}
const redirectUrl =
res.role === 'ROLE_TEACHER' ? '/register/teacher' : '/register'
setAccessExpires(res.accessTokenExp)
setRefreshExpires(res.refreshTokenExp)
addToast('success', '로그인에 성공했습니다')
await router.push(res.isExist ? '/' : redirectUrl)
loadingClose()
Expand Down
76 changes: 0 additions & 76 deletions packages/app/src/features/auth/hook/useAutoReissue.tsx

This file was deleted.

47 changes: 0 additions & 47 deletions packages/app/src/features/auth/hook/useLoggedIn.tsx

This file was deleted.

12 changes: 3 additions & 9 deletions packages/app/src/features/auth/hook/useLogout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,14 @@ import { useDialog } from '@hooks'
import { useToast } from '@features/toast'
import { useDispatch } from 'react-redux'
import { actions } from '@features/student/stores'
import { rtkApi } from '@api'
import useLocalStorage from '@features/global/hooks/useLocalStorage'
import Token from '@lib/Token'
import useLoggedInMutation from '@features/auth/queries/useLoggedInMutation'

const useLogout = () => {
const { dialog } = useDialog()
const { addToast } = useToast()
const dispatch = useDispatch()
const router = useRouter()
const [_, setAccess] = useLocalStorage(Token.ACCESS_TOKEN_EXP, '')
const [__, setRefresh] = useLocalStorage(Token.REFRESH_TOKEN_EXP, '')
const mutate = useLoggedInMutation()

const onLogout = async () => {
if (
Expand All @@ -28,12 +25,9 @@ const useLogout = () => {
const res = await logout()
if (res) return addToast('error', res)

setAccess('')
setRefresh('')
mutate()
addToast('success', '로그아웃에 성공했습니다')
dispatch(actions.resetPage())
dispatch(actions.resetStudents())
dispatch(rtkApi.util.resetApiState())

router.push('/')
}
Expand Down
3 changes: 0 additions & 3 deletions packages/app/src/features/auth/hook/useWithdraw.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ import { useToast } from '@features/toast'
import { useDialog } from '@hooks'
import { useDispatch } from 'react-redux'
import { actions } from '@features/student/stores'
import useLoggedIn from './useLoggedIn'

const useWithdraw = () => {
const { dialog } = useDialog()
const { addToast } = useToast()
const dispatch = useDispatch()
const { refetchLoggedIn } = useLoggedIn({})
const router = useRouter()

const onWithdraw = async () => {
Expand All @@ -29,7 +27,6 @@ const useWithdraw = () => {
dispatch(actions.resetPage())
dispatch(actions.resetStudents())
router.push('/')
refetchLoggedIn()
}

return { onWithdraw }
Expand Down
Loading

0 comments on commit 7523b62

Please sign in to comment.