@fy-/fws-vue 0.4.2 → 0.4.4
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.
|
@@ -13,9 +13,11 @@ import { Uploader } from "@fy-/fws-js";
|
|
|
13
13
|
const props = withDefaults(
|
|
14
14
|
defineProps<{
|
|
15
15
|
imageDomain?: string;
|
|
16
|
+
onCompleted?: (data: any) => void;
|
|
16
17
|
}>(),
|
|
17
18
|
{
|
|
18
19
|
imageDomain: "https://s.nocachenocry.com",
|
|
20
|
+
onCompleted: () => {},
|
|
19
21
|
},
|
|
20
22
|
);
|
|
21
23
|
const rest = useRest();
|
|
@@ -73,8 +75,10 @@ const patchUser = async () => {
|
|
|
73
75
|
data.Birthdate = birtdateAtUnixms;
|
|
74
76
|
const response = await rest("User/_Profile", "PATCH", data);
|
|
75
77
|
if (response && response.result == "success") {
|
|
78
|
+
if (props.onCompleted) {
|
|
79
|
+
props.onCompleted(response);
|
|
80
|
+
}
|
|
76
81
|
eventBus.emit("user:refresh", true);
|
|
77
|
-
eventBus.emit("profileForceModal", true);
|
|
78
82
|
}
|
|
79
83
|
}
|
|
80
84
|
eventBus.emit("main-loading", false);
|
|
@@ -8,6 +8,14 @@ import { computed, reactive, watchEffect, ref } from "vue";
|
|
|
8
8
|
import { required } from "@vuelidate/validators";
|
|
9
9
|
|
|
10
10
|
const rest = useRest();
|
|
11
|
+
const props = withDefaults(
|
|
12
|
+
defineProps<{
|
|
13
|
+
onCompleted?: (data: any) => void;
|
|
14
|
+
}>(),
|
|
15
|
+
{
|
|
16
|
+
onCompleted: () => {},
|
|
17
|
+
},
|
|
18
|
+
);
|
|
11
19
|
const userStore = useUserStore();
|
|
12
20
|
const userData = computed(() => userStore.user);
|
|
13
21
|
const eventBus = useEventBus();
|
|
@@ -16,6 +24,7 @@ const state = reactive({
|
|
|
16
24
|
Username: userData.value?.UserProfile?.Username || "",
|
|
17
25
|
Gender: userData.value?.UserProfile?.Gender || "",
|
|
18
26
|
Birthdate: userData.value?.UserProfile?.Birthdate || "",
|
|
27
|
+
AcceptedTerms: userData.value?.AcceptedTerms || true,
|
|
19
28
|
},
|
|
20
29
|
});
|
|
21
30
|
watchEffect(() => {
|
|
@@ -27,6 +36,7 @@ watchEffect(() => {
|
|
|
27
36
|
.toISOString()
|
|
28
37
|
.split("T")[0]
|
|
29
38
|
: "",
|
|
39
|
+
AcceptedTerms: userData.value?.AcceptedTerms || true,
|
|
30
40
|
};
|
|
31
41
|
});
|
|
32
42
|
const rules = {
|
|
@@ -40,6 +50,9 @@ const rules = {
|
|
|
40
50
|
Birthdate: {
|
|
41
51
|
required: required,
|
|
42
52
|
},
|
|
53
|
+
AcceptedTerms: {
|
|
54
|
+
required: required,
|
|
55
|
+
},
|
|
43
56
|
},
|
|
44
57
|
};
|
|
45
58
|
const v$ = useVuelidate(rules, state);
|
|
@@ -52,10 +65,12 @@ const patchUser = async () => {
|
|
|
52
65
|
const birtdateAtUnixms = birtdate.getTime();
|
|
53
66
|
// @ts-ignore
|
|
54
67
|
data.Birthdate = birtdateAtUnixms;
|
|
55
|
-
const response = await rest("User/
|
|
68
|
+
const response = await rest("User/_ForceProfile", "PATCH", data);
|
|
56
69
|
if (response && response.result == "success") {
|
|
70
|
+
if (props.onCompleted) {
|
|
71
|
+
props.onCompleted(response);
|
|
72
|
+
}
|
|
57
73
|
eventBus.emit("user:refresh", true);
|
|
58
|
-
eventBus.emit("profileForceModal", true);
|
|
59
74
|
}
|
|
60
75
|
}
|
|
61
76
|
eventBus.emit("main-loading", false);
|
|
@@ -97,6 +112,15 @@ const patchUser = async () => {
|
|
|
97
112
|
:error-vuelidate="v$.userData.Birthdate.$errors"
|
|
98
113
|
/>
|
|
99
114
|
|
|
115
|
+
<DefaultInput
|
|
116
|
+
id="acceptedTermsFWS"
|
|
117
|
+
v-model:checkbox-value="state.userData.AcceptedTerms"
|
|
118
|
+
type="toggle"
|
|
119
|
+
:label="$t('fws_accepted_terms_label')"
|
|
120
|
+
:help="$t('fws_accepted_terms_help')"
|
|
121
|
+
:error-vuelidate="v$.userData.AcceptedTerms.$errors"
|
|
122
|
+
/>
|
|
123
|
+
|
|
100
124
|
<div class="flex">
|
|
101
125
|
<button type="submit" class="btn defaults primary">
|
|
102
126
|
{{ $t("fws_save_user_cta") }}
|