@@ -30,6 +30,7 @@ import {
30
30
} from 'astro_2.0/features/CreateDao/components/helpers' ;
31
31
import { useStateMachine } from 'little-state-machine' ;
32
32
import { useWalletContext } from 'context/WalletContext' ;
33
+ import { GA_EVENTS , sendGAEvent } from 'utils/ga' ;
33
34
34
35
type DaoFormStateReturn = {
35
36
options : DaoSettingOption <
@@ -89,8 +90,7 @@ export function useCreateDao(): {
89
90
uploadAssets : ( defaultFlag : string ) => Promise < string > ;
90
91
createDao : (
91
92
daoName : string ,
92
- data : CreateDaoInput | null ,
93
- args ?: CreateDaoCustomInput
93
+ data : CreateDaoInput | CreateDaoCustomInput
94
94
) => Promise < void > ;
95
95
} {
96
96
const router = useRouter ( ) ;
@@ -131,17 +131,18 @@ export function useCreateDao(): {
131
131
) ;
132
132
133
133
const createDao = useCallback (
134
- async (
135
- daoName : string ,
136
- data : CreateDaoInput | null ,
137
- args ?: CreateDaoCustomInput
138
- ) => {
134
+ async ( daoName : string , data : CreateDaoInput | CreateDaoCustomInput ) => {
139
135
try {
140
- if ( data ) {
141
- await nearService ?. createDao ( data ) ;
142
- } else if ( args ) {
143
- await nearService ?. createDao ( args ) ;
144
- }
136
+ await nearService ?. createDao ( data ) ;
137
+
138
+ const { nearConfig } = configService . get ( ) ;
139
+ const daoId = `${ daoName } .${ nearConfig ?. contractName ?? '' } ` ;
140
+
141
+ sendGAEvent ( {
142
+ name : GA_EVENTS . CREATE_DAO ,
143
+ daoId,
144
+ accountId,
145
+ } ) ;
145
146
146
147
showNotification ( {
147
148
type : NOTIFICATION_TYPES . INFO ,
@@ -154,9 +155,7 @@ export function useCreateDao(): {
154
155
getInitialValues ( accountId , state . assets . defaultFlag )
155
156
) ;
156
157
157
- const { nearConfig } = configService . get ( ) ;
158
-
159
- await router . push ( `/dao/${ daoName } .${ nearConfig ?. contractName ?? '' } ` ) ;
158
+ await router . push ( `/dao/${ daoId } ` ) ;
160
159
} catch ( error ) {
161
160
console . warn ( error ) ;
162
161
0 commit comments