@@ -153,16 +153,16 @@ const sexOptions = [
153
153
{ name: ' Female' , value: false },
154
154
]
155
155
156
- interface UpdateProfileForm <T , S > {
156
+ interface UpdateProfileForm <T , S , D > {
157
157
nickname? : T ;
158
158
signature? : T ;
159
159
sex? : S ;
160
- birthday? : T ;
160
+ birthday? : D ;
161
161
avatar? : T ;
162
162
}
163
163
164
- const updateProfileResolver = ({ values }: { values: UpdateProfileForm <string , boolean > }) => {
165
- const errors: UpdateProfileForm <{ message: string }[], { message: string }[]> = {};
164
+ const updateProfileResolver = ({ values }: { values: UpdateProfileForm <string , boolean , Date > }) => {
165
+ const errors: UpdateProfileForm <{ message: string }[], { message: string }[], { message : string }[] > = {};
166
166
167
167
if (values .nickname && values .nickname .length > 16 ) {
168
168
errors .nickname = [{ message: " Nickname is too long (16 characters max)." }]
@@ -174,7 +174,7 @@ const updateProfileResolver = ({ values }: { values: UpdateProfileForm<string, b
174
174
175
175
const onUpdateProfile = async ({ valid , states }: {
176
176
valid: boolean ,
177
- states: UpdateProfileForm <Ref <string >, Ref <boolean >>
177
+ states: UpdateProfileForm <Ref <string >, Ref <boolean >, Ref < Date > >
178
178
}) => {
179
179
if (! valid ) return ;
180
180
@@ -186,21 +186,22 @@ const onUpdateProfile = async ({ valid, states }: {
186
186
nickname: states .nickname ! .value ,
187
187
signature: states .signature ! .value ,
188
188
sex: states .sex ! .value ,
189
- // birthday: states.birthday!.value,
189
+ birthday: states .birthday ! .value . toISOString (). replace ( ' Z ' , ' ' ) ,
190
190
avatar: accountStore .account ! .avatar ,
191
191
}
192
192
})
193
193
if (! res .success ) {
194
- toast .add ({ severity: " error" , summary: " Update failed" , detail: res .message });
195
- } else {
196
- toast .add ({ severity: " success" , summary: " Profile updated" , detail: " Your profile has been updated." , life: 3000 });
197
- accountStore .mergeProfile ({
198
- nickname: states .nickname ! .value ,
199
- signature: states .signature ! .value ,
200
- sex: states .sex ! .value ,
201
- // birthday: states.birthday!.value,
202
- })
194
+ inProgress .value = false ;
195
+ return toast .add ({ severity: " error" , summary: " Update failed" , detail: res .message });
203
196
}
197
+ toast .add ({ severity: " success" , summary: " Profile updated" , detail: " Your profile has been updated." , life: 3000 });
198
+ accountStore .mergeProfile ({
199
+ nickname: states .nickname ! .value ,
200
+ signature: states .signature ! .value ,
201
+ sex: states .sex ! .value ,
202
+ birthday: states .birthday ! .value .toISOString ().replace (' Z' , ' ' ),
203
+ })
204
+
204
205
inProgress .value = false ;
205
206
206
207
activeStep .value = " 3" ;
@@ -394,7 +395,7 @@ const path = [
394
395
$form.sex.error.message }}</Message >
395
396
</div >
396
397
<div class =" flex flex-col gap-1 w-full" >
397
- <InputText name =" birthday" type = " text " placeholder =" Birthday" fluid :disabled = " true " />
398
+ <DatePicker name =" birthday" placeholder =" Birthday" fluid />
398
399
<Message v-if =" $form.birthday?.invalid" severity =" error" size =" small" variant =" simple" >{{
399
400
$form.birthday.error.message }}</Message >
400
401
</div >
0 commit comments