@icvdeveloper/common-module 0.0.100 → 0.0.101
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.
package/dist/module.json
CHANGED
|
@@ -4,11 +4,13 @@ import { useRouter } from "vue-router";
|
|
|
4
4
|
import { useApi } from "./useApi.mjs";
|
|
5
5
|
import { useAuthStore } from "../store/auth.mjs";
|
|
6
6
|
import { useTemplateConfigsStore } from "../store/templateConfigs.mjs";
|
|
7
|
+
import { useConferencesStore } from "../store/conferences.mjs";
|
|
7
8
|
import { useConferenceHelpers } from "../composables/useConferenceHelpers.mjs";
|
|
8
9
|
export const useUcc = () => {
|
|
9
10
|
const { globalConfigValue } = useTemplateConfigsStore();
|
|
10
11
|
const { user, isLoggedIn } = storeToRefs(useAuthStore());
|
|
11
|
-
const {
|
|
12
|
+
const { loginEmailOnly } = useAuthStore();
|
|
13
|
+
const { selectedConference } = storeToRefs(useConferencesStore());
|
|
12
14
|
const router = useRouter();
|
|
13
15
|
const loadUccScript = (conference, eventPathPrefix) => {
|
|
14
16
|
console.log("conference", conference);
|
|
@@ -35,7 +37,8 @@ export const useUcc = () => {
|
|
|
35
37
|
if (isLoggedIn.value) {
|
|
36
38
|
console.log("onload auth user.value", user.value);
|
|
37
39
|
let hasAccess = find(get(user, "value.conferences", []), { id: window.uccMixin.conference.id });
|
|
38
|
-
|
|
40
|
+
if (window.uccMixin.conference.state == "archive")
|
|
41
|
+
toggleEmailFormDisplay(!hasAccess);
|
|
39
42
|
} else if (window.uccMixin.conference) {
|
|
40
43
|
if (window.uccMixin.conference.state == "upcoming") {
|
|
41
44
|
window.uccMixin.uccShowEventSignUp();
|
|
@@ -106,10 +109,12 @@ export const useUcc = () => {
|
|
|
106
109
|
console.log("hasAccess", hasAccess);
|
|
107
110
|
if (hasAccess) {
|
|
108
111
|
console.log("isLoggedIn", isLoggedIn.value);
|
|
109
|
-
|
|
112
|
+
loginEmailOnly(response.data).then(() => {
|
|
113
|
+
console.log("selectedConference", selectedConference.value);
|
|
114
|
+
postAuthRedirect();
|
|
115
|
+
});
|
|
110
116
|
console.log("auth user", user);
|
|
111
117
|
console.log("isLoggedIn", isLoggedIn.value);
|
|
112
|
-
postAuthRedirect();
|
|
113
118
|
} else {
|
|
114
119
|
uccShowEventSignUp(email);
|
|
115
120
|
}
|
|
@@ -10,7 +10,7 @@ export type LoginParams = {
|
|
|
10
10
|
export declare const useAuthStore: import("pinia").StoreDefinition<"auth", AuthStoreState, {
|
|
11
11
|
isLoggedIn: (state: AuthStoreState) => boolean;
|
|
12
12
|
}, {
|
|
13
|
-
|
|
13
|
+
loginEmailOnly(data: object): Promise<AuthUser>;
|
|
14
14
|
login(params: LoginParams): Promise<AuthUser>;
|
|
15
15
|
logout(): Promise<void>;
|
|
16
16
|
update(data: AuthUser): Promise<void>;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { defineStore } from "pinia";
|
|
2
|
+
import { merge } from "lodash-es";
|
|
2
3
|
import { useApi } from "../composables/useApi.mjs";
|
|
4
|
+
import { useConferencesStore } from "./conferences.mjs";
|
|
3
5
|
export const useAuthStore = defineStore("auth", {
|
|
4
6
|
persist: true,
|
|
5
7
|
state: () => ({
|
|
@@ -12,9 +14,24 @@ export const useAuthStore = defineStore("auth", {
|
|
|
12
14
|
}
|
|
13
15
|
},
|
|
14
16
|
actions: {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
loginEmailOnly(data) {
|
|
18
|
+
return new Promise((resolve, reject) => {
|
|
19
|
+
const request = useApi();
|
|
20
|
+
request(
|
|
21
|
+
`users/email/${data.email}?with=token`
|
|
22
|
+
).then((response) => {
|
|
23
|
+
console.log("data", data);
|
|
24
|
+
let mergedUser = merge(data, response);
|
|
25
|
+
console.log("merged user", mergedUser);
|
|
26
|
+
this.user = mergedUser;
|
|
27
|
+
const { selectedConference, getSelectedConference } = useConferencesStore();
|
|
28
|
+
console.log("refreshing selected conference", selectedConference.id);
|
|
29
|
+
getSelectedConference(selectedConference.id);
|
|
30
|
+
resolve(response);
|
|
31
|
+
}).catch((error) => {
|
|
32
|
+
reject(error);
|
|
33
|
+
});
|
|
34
|
+
});
|
|
18
35
|
},
|
|
19
36
|
login(params) {
|
|
20
37
|
return new Promise((resolve, reject) => {
|