@@ -62,9 +62,9 @@ const requestFaucet = async (address: string, amount: number, secret: string) =>
62
62
const minTimer = new Promise ((resolve ) => setTimeout (resolve , 2000 ))
63
63
64
64
const displayError = (e : string ) => {
65
- store .status = ' error'
66
65
error .value = e
67
- store .contentStep = 0
66
+ store .status = ' error'
67
+
68
68
console .error (e )
69
69
}
70
70
try {
@@ -75,22 +75,22 @@ const requestFaucet = async (address: string, amount: number, secret: string) =>
75
75
},
76
76
body: JSON .stringify ({
77
77
to: address ,
78
- amount: amount * 1000000 + ' ugnot' ,
78
+ amount: amount * 1000000 + ' ugnot' , // TODO: need to be dynamyc if different token
79
79
captcha: secret ,
80
80
}),
81
81
})
82
82
83
83
await minTimer
84
84
const faucetResponse = await response .json ()
85
85
86
- store .status = ! faucetResponse .result ? ' error' : ' success'
86
+ store .status = response . status !== 200 || faucetResponse .error ? ' error' : ' success'
87
87
88
88
// Check the faucet response
89
- if (! response .ok || store .status === ' error' ) {
90
- displayError (faucetResponse .error .message )
91
- } else {
89
+ if (response .status === 200 && store .status === ' success' ) {
92
90
store .status = ' success'
93
91
txLink .value = faucetResponse .result ?? ' ' // TODO: get tx link
92
+ } else {
93
+ displayError (faucetResponse .error )
94
94
}
95
95
} catch (e ) {
96
96
await minTimer
@@ -143,9 +143,20 @@ watch(
143
143
toggleLoader (false )
144
144
setPopupHeight ()
145
145
146
- gsap .to (' .js-faucetform' , {
147
- autoAlpha: 1 ,
148
- duration: 0.5 ,
146
+ gsap .to (' .js-faucetpending' , {
147
+ autoAlpha: 0 ,
148
+ duration: 0.6 ,
149
+ onComplete : () => {
150
+ store .contentStep = 0
151
+ popupHeight .from = popupHeight .to
152
+ gsap .set (DOMpopup .value , { height: ' auto' })
153
+
154
+ gsap .to (' .js-faucetform' , {
155
+ autoAlpha: 1 ,
156
+ duration: 0.5 ,
157
+ })
158
+ gsap .set (' .js-faucetpending' , { autoAlpha: 1 })
159
+ },
149
160
})
150
161
break
151
162
0 commit comments