@fy-/fws-vue 0.9.3 → 0.9.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -134,7 +134,7 @@ const userFlow = async (params: paramsType = { initial: false }) => {
134
134
  }
135
135
  } else {
136
136
  if (props.onSuccess) {
137
- await props.onSuccess();
137
+ await props.onSuccess(actualReturnTo);
138
138
  } else {
139
139
  const routeExists = router.resolve(actualReturnTo);
140
140
  if (routeExists.matched.length != 0) router.push(actualReturnTo);
@@ -14,10 +14,12 @@ const props = withDefaults(
14
14
  defineProps<{
15
15
  imageDomain?: string;
16
16
  onCompleted?: (data: any) => void;
17
+ hidePublic?: boolean;
17
18
  }>(),
18
19
  {
19
20
  imageDomain: "https://s.nocachenocry.com",
20
21
  onCompleted: () => {},
22
+ hidePublic: false,
21
23
  },
22
24
  );
23
25
  const rest = useRest();
@@ -70,9 +72,15 @@ const patchUser = async () => {
70
72
  if (await v$.value.userData.$validate()) {
71
73
  const data = { ...state.userData };
72
74
  const birtdate = new Date(`${data.Birthdate}T00:00:00Z`);
73
- const birtdateAtUnixms = birtdate.getTime();
75
+ try {
76
+ const birtdateAtUnixms = birtdate.getTime();
77
+ // format for go in string
78
+ data.Birthdate = new Date(birtdateAtUnixms).toISOString().split("T")[0];
79
+ } catch (e) {
80
+ const birtdateAtUnixms = new Date(birtdate).getTime();
81
+ data.Birthdate = new Date(birtdateAtUnixms).toISOString().split("T")[0];
82
+ }
74
83
  // @ts-ignore
75
- data.Birthdate = birtdateAtUnixms;
76
84
  const response = await rest("User/_Profile", "PATCH", data);
77
85
  if (response && response.result == "success") {
78
86
  if (props.onCompleted) {
@@ -223,28 +231,29 @@ function selectFile(e: Event) {
223
231
  :label="$t('fws_bio_label')"
224
232
  :error-vuelidate="v$.userData.Bio.$errors"
225
233
  />
226
- <DefaultInput
227
- id="publicGenderFWS"
228
- v-model:checkbox-value="state.userData.PublicGender"
229
- type="toggle"
230
- :label="$t('fws_public_gender')"
231
- :error-vuelidate="v$.userData.PublicGender.$errors"
232
- />
233
- <DefaultInput
234
- id="publicBioFWS"
235
- v-model:checkbox-value="state.userData.PublicBio"
236
- type="toggle"
237
- :label="$t('fws_public_bio')"
238
- :error-vuelidate="v$.userData.PublicBio.$errors"
239
- />
240
- <DefaultInput
241
- id="publicBirthdateFWS"
242
- v-model:checkbox-value="state.userData.PublicBirthdate"
243
- type="toggle"
244
- :label="$t('fws_public_birthdate')"
245
- :error-vuelidate="v$.userData.PublicBirthdate.$errors"
246
- />
247
-
234
+ <template v-if="!hidePublic">
235
+ <DefaultInput
236
+ id="publicGenderFWS"
237
+ v-model:checkbox-value="state.userData.PublicGender"
238
+ type="toggle"
239
+ :label="$t('fws_public_gender')"
240
+ :error-vuelidate="v$.userData.PublicGender.$errors"
241
+ />
242
+ <DefaultInput
243
+ id="publicBioFWS"
244
+ v-model:checkbox-value="state.userData.PublicBio"
245
+ type="toggle"
246
+ :label="$t('fws_public_bio')"
247
+ :error-vuelidate="v$.userData.PublicBio.$errors"
248
+ />
249
+ <DefaultInput
250
+ id="publicBirthdateFWS"
251
+ v-model:checkbox-value="state.userData.PublicBirthdate"
252
+ type="toggle"
253
+ :label="$t('fws_public_birthdate')"
254
+ :error-vuelidate="v$.userData.PublicBirthdate.$errors"
255
+ />
256
+ </template>
248
257
  <div class="flex">
249
258
  <button type="submit" class="btn defaults primary">
250
259
  {{ $t("fws_save_user_cta") }}
@@ -82,9 +82,14 @@ const patchUser = async () => {
82
82
  if (await v$.value.userData.$validate()) {
83
83
  const data = { ...state.userData };
84
84
  const birtdate = new Date(`${data.Birthdate}T00:00:00Z`);
85
- const birtdateAtUnixms = birtdate.getTime();
86
- // @ts-ignore
87
- data.Birthdate = birtdateAtUnixms;
85
+ try {
86
+ const birtdateAtUnixms = birtdate.getTime();
87
+ // format for go in string
88
+ data.Birthdate = new Date(birtdateAtUnixms).toISOString().split("T")[0];
89
+ } catch (e) {
90
+ const birtdateAtUnixms = new Date(birtdate).getTime();
91
+ data.Birthdate = new Date(birtdateAtUnixms).toISOString().split("T")[0];
92
+ }
88
93
  const response = await rest("User/_ForceProfile", "PATCH", data);
89
94
  if (response && response.result == "success") {
90
95
  if (props.onCompleted) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fy-/fws-vue",
3
- "version": "0.9.3",
3
+ "version": "0.9.5",
4
4
  "author": "Florian 'Fy' Gasquez <m@fy.to>",
5
5
  "license": "MIT",
6
6
  "repository": {