Skip to content
This repository has been archived by the owner on Dec 16, 2024. It is now read-only.

Commit

Permalink
feat: implements create survey page
Browse files Browse the repository at this point in the history
  • Loading branch information
jspark2000 committed Mar 11, 2024
1 parent 21834d8 commit 79e8a9c
Show file tree
Hide file tree
Showing 15 changed files with 757 additions and 49 deletions.
1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"@headlessui/react": "^1.7.18",
"@heroicons/react": "^2.1.1",
"@hookform/resolvers": "^3.3.4",
"@radix-ui/react-checkbox": "^1.0.4",
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-dropdown-menu": "^2.0.6",
"@radix-ui/react-icons": "^1.3.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default function CreateRosterForm() {
...data,
class: data.class === '' ? '없음' : data.class
})
router.push('/console/roster')
router.push('/console/roster?revalidate=true')
toast.success('부원을 등록했습니다')
} catch (error) {
toast.error('부원을 등록하지 못했습니다')
Expand Down Expand Up @@ -261,7 +261,11 @@ export default function CreateRosterForm() {
<Button type="submit" disabled={isFetching}>
생성하기
</Button>
<Button variant={'outline'} onClick={() => router.back()}>
<Button
type="button"
variant={'outline'}
onClick={() => router.back()}
>
목록으로
</Button>
</div>
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/app/console/roster/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Button } from '@/components/ui/button'
import { getRosters } from '@/lib/actions'
import { calculateTotalPages } from '@/lib/utils'
import { PAGINATION_LIMIT_DEFAULT } from '@/lib/vars'
import { revalidatePath } from 'next/cache'
import Link from 'next/link'
import RosterListTable from './_components/RosterListTable'

Expand All @@ -11,11 +12,16 @@ export default async function RosterPage({
}: {
searchParams?: {
page?: string
revalidate?: string
}
}) {
const currentPage = Number(searchParams?.page) || 1
const rosterList = await getRosters(currentPage)

if (searchParams?.revalidate) {
revalidatePath('/console/roster')
}

return (
<main className="mx-auto flex w-full flex-grow flex-col items-center justify-start">
<div className="mt-4 flex w-full items-center justify-between px-4 text-left sm:px-6">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,15 @@ export default function UpdateSurveyGroupForm({
const data = {
startedAt: toUTCString(
createLocalDate(
formData.startedAtDate.toISOString().substring(0, 10) +
`${formData.startedAtDate.getFullYear()}-${formData.startedAtDate.getMonth() + 1}-${formData.startedAtDate.getDate()}` +
' ' +
formData.startedAtTime,
'YYYY-MM-DD HH:mm'
)
),
endedAt: toUTCString(
createLocalDate(
formData.endedAtDate.toISOString().substring(0, 10) +
`${formData.endedAtDate.getFullYear()}-${formData.endedAtDate.getMonth() + 1}-${formData.endedAtDate.getDate()}` +
' ' +
formData.endedAtTime,
'YYYY-MM-DD HH:mm'
Expand Down
Loading

0 comments on commit 79e8a9c

Please sign in to comment.