File tree Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Original file line number Diff line number Diff line change 1
1
import supabase from '@/supabase' ;
2
2
import { Member } from '@/types/Member' ;
3
+ interface addGroupShedule {
4
+ title : string ;
5
+ description : string ;
6
+ startDate : string ;
7
+ endDate : string ;
8
+ memo : string ;
9
+ newMemberList : any [ ] ;
10
+ }
11
+
12
+ export const addGroupSchedule = async ( { startDate, endDate, ...props } : addGroupShedule ) => {
13
+ const { error } = await supabase
14
+ . from ( 'group_schedules' )
15
+ . insert ( { ...props , start_date : startDate , end_date : endDate } ) ;
16
+
17
+ if ( error ) {
18
+ throw error ;
19
+ }
20
+ } ;
3
21
4
22
export const getOneGroupSchedule = async ( scheduleId : string ) => {
5
23
const { data, error } = await supabase . from ( 'group_schedules' ) . select ( '*' ) . eq ( 'id' , + scheduleId ) ;
Original file line number Diff line number Diff line change
1
+ import { addGroupSchedule } from '@/apis/groupScheduleApis' ;
1
2
import GroupForm from '@/components/Group/GroupForm' ;
2
3
import AppBar from '@/components/common/AppBar' ;
4
+ import { Member } from '@/types/Member' ;
3
5
4
6
const AddGroupPage = ( ) => {
5
- const handleSubmit : React . FormEventHandler < HTMLFormElement > = ( e ) => {
7
+ const handleSubmit = ( e : React . FormEvent < HTMLFormElement > , userList : Member [ ] ) => {
6
8
e . preventDefault ( ) ;
7
9
const formData = new FormData ( e . currentTarget ) ;
8
- console . log ( formData . get ( 'name' ) ) ;
10
+ const addSchedule = {
11
+ title : formData . get ( 'name' ) as string ,
12
+ description : formData . get ( 'description' ) as string ,
13
+ startDate : formData . get ( 'startDate' ) as string ,
14
+ endDate : formData . get ( 'endDate' ) as string ,
15
+ memo : formData . get ( 'memo' ) as string ,
16
+ newMemberList : userList ,
17
+ } ;
18
+ addGroupSchedule ( addSchedule ) ;
9
19
} ;
10
20
11
21
return (
You can’t perform that action at this time.
0 commit comments