@dative-gpi/foundation-shared-services 0.0.12 → 0.0.14
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/composables/services/index.ts +0 -6
- package/composables/services/useApplications.ts +11 -11
- package/composables/services/useImages.ts +20 -20
- package/composables/services/useTranslations.ts +6 -6
- package/composables/services/useUsers.ts +11 -11
- package/composables/useShared.ts +22 -22
- package/config/urls/index.ts +0 -6
- package/package.json +3 -3
- package/composables/services/useFrequentlyAskedQuestions.ts +0 -11
- package/composables/services/useLandingPages.ts +0 -50
- package/composables/services/useLayoutPages.ts +0 -50
- package/composables/services/useLegalInformations.ts +0 -50
- package/composables/services/useSecuritySettings.ts +0 -50
- package/composables/services/useUserLegalInformations.ts +0 -52
- package/config/urls/frequentlyAskedQuestions.ts +0 -3
- package/config/urls/landingPages.ts +0 -4
- package/config/urls/layoutPages.ts +0 -4
- package/config/urls/legalInformations.ts +0 -4
- package/config/urls/securitySettings.ts +0 -4
- package/config/urls/userLegalInformations.ts +0 -4
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
export * from "./useApplications";
|
|
2
2
|
export * from "./useAuthTokens";
|
|
3
|
-
export * from "./useFrequentlyAskedQuestions";
|
|
4
3
|
export * from "./useImages";
|
|
5
|
-
export * from "./useLandingPages";
|
|
6
|
-
export * from "./useLayoutPages";
|
|
7
|
-
export * from "./useLegalInformations";
|
|
8
4
|
export * from "./useOrganisations";
|
|
9
|
-
export * from "./useSecuritySettings";
|
|
10
5
|
export * from "./useTimeZones";
|
|
11
6
|
export * from "./useTranslations";
|
|
12
|
-
export * from "./useUserLegalInformations";
|
|
13
7
|
export * from "./useUsers";
|
|
@@ -22,29 +22,29 @@ export const useCurrentApplication = () => {
|
|
|
22
22
|
const service = ApplicationServiceFactory();
|
|
23
23
|
const subscribersIds: number[] = [];
|
|
24
24
|
|
|
25
|
-
const
|
|
26
|
-
const
|
|
25
|
+
const getting = ref(false);
|
|
26
|
+
const entity = ref<ApplicationDetails | null>(null);
|
|
27
27
|
|
|
28
28
|
onUnmounted(() => {
|
|
29
29
|
subscribersIds.forEach(id => service.unsubscribe(id));
|
|
30
30
|
subscribersIds.length = 0;
|
|
31
31
|
});
|
|
32
32
|
|
|
33
|
-
const
|
|
34
|
-
|
|
33
|
+
const get = async () => {
|
|
34
|
+
getting.value = true;
|
|
35
35
|
try {
|
|
36
|
-
|
|
36
|
+
entity.value = await service.getCurrent();
|
|
37
37
|
}
|
|
38
38
|
finally {
|
|
39
|
-
|
|
39
|
+
getting.value = false;
|
|
40
40
|
}
|
|
41
|
-
subscribersIds.push(service.subscribe("all", onEntityChanged(
|
|
42
|
-
return
|
|
41
|
+
subscribersIds.push(service.subscribe("all", onEntityChanged(entity)));
|
|
42
|
+
return entity;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
return {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
getting,
|
|
47
|
+
get,
|
|
48
|
+
entity
|
|
49
49
|
}
|
|
50
50
|
}
|
|
@@ -24,46 +24,46 @@ const ImageServiceFactory = new ServiceFactory("image", BlurHash).create(factory
|
|
|
24
24
|
export const useImageRaw = () => {
|
|
25
25
|
const service = ImageServiceFactory();
|
|
26
26
|
|
|
27
|
-
const
|
|
28
|
-
const
|
|
27
|
+
const getting = ref(false);
|
|
28
|
+
const entity = ref<string | null>(null);
|
|
29
29
|
|
|
30
|
-
const
|
|
31
|
-
|
|
30
|
+
const get = async (imageId: string) => {
|
|
31
|
+
getting.value = true;
|
|
32
32
|
try {
|
|
33
|
-
|
|
33
|
+
entity.value = await service.getRaw(imageId);
|
|
34
34
|
}
|
|
35
35
|
finally {
|
|
36
|
-
|
|
36
|
+
getting.value = false;
|
|
37
37
|
}
|
|
38
|
-
return
|
|
38
|
+
return entity;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
return {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
getting,
|
|
43
|
+
get,
|
|
44
|
+
entity
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
export const useImageBlurHash = () => {
|
|
48
48
|
const service = ImageServiceFactory();
|
|
49
49
|
|
|
50
|
-
const
|
|
51
|
-
const
|
|
50
|
+
const getting = ref(false);
|
|
51
|
+
const entity = ref<BlurHash | null>(null);
|
|
52
52
|
|
|
53
|
-
const
|
|
54
|
-
|
|
53
|
+
const get = async (imageId: string) => {
|
|
54
|
+
getting.value = true;
|
|
55
55
|
try {
|
|
56
|
-
|
|
56
|
+
entity.value = await service.getBlurHash(imageId);
|
|
57
57
|
}
|
|
58
58
|
finally {
|
|
59
|
-
|
|
59
|
+
getting.value = false;
|
|
60
60
|
}
|
|
61
|
-
return
|
|
61
|
+
return entity;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
return {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
getting,
|
|
66
|
+
get,
|
|
67
|
+
entity
|
|
68
68
|
}
|
|
69
69
|
}
|
|
@@ -20,22 +20,22 @@ export const useTranslations = () => {
|
|
|
20
20
|
const service = TranslationServiceFactory();
|
|
21
21
|
|
|
22
22
|
const fetching = ref(false);
|
|
23
|
-
const
|
|
23
|
+
const entities = ref<TranslationInfos[]>([]);
|
|
24
24
|
|
|
25
|
-
const
|
|
25
|
+
const getMany = async (languageCode: string) => {
|
|
26
26
|
fetching.value = true;
|
|
27
27
|
try {
|
|
28
|
-
|
|
28
|
+
entities.value = await service.getMany(languageCode);
|
|
29
29
|
}
|
|
30
30
|
finally {
|
|
31
31
|
fetching.value = false;
|
|
32
32
|
}
|
|
33
|
-
return
|
|
33
|
+
return entities;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
return {
|
|
37
37
|
fetching,
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
getMany,
|
|
39
|
+
entities
|
|
40
40
|
}
|
|
41
41
|
}
|
|
@@ -30,30 +30,30 @@ export const useCurrentUser = () => {
|
|
|
30
30
|
const service = UserServiceFactory();
|
|
31
31
|
const subscribersIds: number[] = [];
|
|
32
32
|
|
|
33
|
-
const
|
|
34
|
-
const
|
|
33
|
+
const getting = ref(false);
|
|
34
|
+
const entity = ref<UserDetails | null>(null);
|
|
35
35
|
|
|
36
36
|
onUnmounted(() => {
|
|
37
37
|
subscribersIds.forEach(id => service.unsubscribe(id));
|
|
38
38
|
subscribersIds.length = 0;
|
|
39
39
|
});
|
|
40
40
|
|
|
41
|
-
const
|
|
42
|
-
|
|
41
|
+
const get = async () => {
|
|
42
|
+
getting.value = true;
|
|
43
43
|
try {
|
|
44
|
-
|
|
44
|
+
entity.value = await service.getCurrent();
|
|
45
45
|
}
|
|
46
46
|
finally {
|
|
47
|
-
|
|
47
|
+
getting.value = false;
|
|
48
48
|
}
|
|
49
|
-
subscribersIds.push(service.subscribe("all", onEntityChanged(
|
|
50
|
-
return
|
|
49
|
+
subscribersIds.push(service.subscribe("all", onEntityChanged(entity)));
|
|
50
|
+
return entity;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
return {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
getting,
|
|
55
|
+
get,
|
|
56
|
+
entity
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
export const useUpdateCurrentUser = () => {
|
package/composables/useShared.ts
CHANGED
|
@@ -11,30 +11,30 @@ let called = false;
|
|
|
11
11
|
const ready = ref(false);
|
|
12
12
|
|
|
13
13
|
export function useShared() {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
if (called) {
|
|
15
|
+
return {
|
|
16
|
+
ready
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
called = true;
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
const { ready: languageCodeReady, languageCode } = useLanguageCode();
|
|
23
|
+
const { ready: timeZoneReady } = useTimeZone();
|
|
24
|
+
const { getMany, entities } = useTranslations();
|
|
25
|
+
const { set } = useTranslationsProvider();
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
27
|
+
onMounted(async () => {
|
|
28
|
+
await languageCodeReady
|
|
29
|
+
await timeZoneReady;
|
|
30
|
+
if (languageCode.value) {
|
|
31
|
+
await getMany(languageCode.value!);
|
|
32
|
+
set(entities.value.map(t => ({ code: t.code, value: t.value })));
|
|
33
|
+
}
|
|
34
|
+
ready.value = true;
|
|
35
|
+
});
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
return {
|
|
38
|
+
ready
|
|
39
|
+
};
|
|
40
40
|
}
|
package/config/urls/index.ts
CHANGED
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
export * from "./applications";
|
|
2
2
|
export * from "./authTokens";
|
|
3
3
|
export * from "./files";
|
|
4
|
-
export * from "./frequentlyAskedQuestions";
|
|
5
4
|
export * from "./images";
|
|
6
|
-
export * from "./landingPages";
|
|
7
|
-
export * from "./layoutPages";
|
|
8
|
-
export * from "./legalInformations";
|
|
9
5
|
export * from "./organisations";
|
|
10
|
-
export * from "./securitySettings";
|
|
11
6
|
export * from "./timeZones";
|
|
12
7
|
export * from "./translations";
|
|
13
|
-
export * from "./userLegalInformations";
|
|
14
8
|
export * from "./users";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dative-gpi/foundation-shared-services",
|
|
3
3
|
"sideEffects": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.14",
|
|
5
5
|
"description": "",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
"license": "ISC",
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@dative-gpi/bones-ui": "^0.0.61",
|
|
14
|
-
"@dative-gpi/foundation-shared-domain": "0.0.
|
|
14
|
+
"@dative-gpi/foundation-shared-domain": "0.0.14",
|
|
15
15
|
"@microsoft/signalr": "^8.0.0",
|
|
16
16
|
"date-fns": "^3.2.0",
|
|
17
17
|
"vue": "^3.2.0",
|
|
18
18
|
"vue-router": "^4.2.5"
|
|
19
19
|
},
|
|
20
|
-
"gitHead": "
|
|
20
|
+
"gitHead": "e0e44041b264a555d7eccfb49ae4deaf933bd436"
|
|
21
21
|
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { FrequentlyAskedQuestionDetails, FrequentlyAskedQuestionDetailsDTO, FrequentlyAskedQuestionFilters, FrequentlyAskedQuestionInfos, FrequentlyAskedQuestionInfosDTO } from "@dative-gpi/foundation-shared-domain/models";
|
|
2
|
-
import { ComposableFactory, ServiceFactory } from "@dative-gpi/bones-ui";
|
|
3
|
-
|
|
4
|
-
import { FREQUENTLY_ASKED_QUESTIONS_URL } from "../../config/urls";
|
|
5
|
-
|
|
6
|
-
const FrequentlyAskedQuestionServiceFactory = new ServiceFactory<FrequentlyAskedQuestionDetailsDTO, FrequentlyAskedQuestionDetails>("frequentlyAskedQuestions", FrequentlyAskedQuestionDetails).create(factory => factory.build(
|
|
7
|
-
factory.addGetMany<FrequentlyAskedQuestionInfosDTO, FrequentlyAskedQuestionInfos, FrequentlyAskedQuestionFilters>(FREQUENTLY_ASKED_QUESTIONS_URL, FrequentlyAskedQuestionInfos),
|
|
8
|
-
factory.addNotify()
|
|
9
|
-
));
|
|
10
|
-
|
|
11
|
-
export const useFrequentlyAskedQuestions = ComposableFactory.getMany(FrequentlyAskedQuestionServiceFactory);
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { onUnmounted, ref } from "vue";
|
|
2
|
-
|
|
3
|
-
import { LandingPageDetails, LandingPageDetailsDTO } from "@dative-gpi/foundation-shared-domain/models";
|
|
4
|
-
import { onEntityChanged, ServiceFactory } from "@dative-gpi/bones-ui";
|
|
5
|
-
|
|
6
|
-
import { LANDING_PAGE_CURRENT_URL } from "../../config/urls";
|
|
7
|
-
|
|
8
|
-
const LandingPageServiceFactory = new ServiceFactory<LandingPageDetailsDTO, LandingPageDetails>("landingPage", LandingPageDetails).create(factory => factory.build(
|
|
9
|
-
factory.addNotify((notifyService) => ({
|
|
10
|
-
getCurrent: async (): Promise<LandingPageDetails> => {
|
|
11
|
-
const response = await ServiceFactory.http.get(LANDING_PAGE_CURRENT_URL());
|
|
12
|
-
const result = new LandingPageDetails(response.data);
|
|
13
|
-
|
|
14
|
-
notifyService.notify("update", result);
|
|
15
|
-
|
|
16
|
-
return result;
|
|
17
|
-
}
|
|
18
|
-
}))
|
|
19
|
-
));
|
|
20
|
-
|
|
21
|
-
export const useCurrentLandingPage = () => {
|
|
22
|
-
const service = LandingPageServiceFactory();
|
|
23
|
-
const subscribersIds: number[] = [];
|
|
24
|
-
|
|
25
|
-
const fetching = ref(false);
|
|
26
|
-
const fetched = ref<LandingPageDetails | null>(null);
|
|
27
|
-
|
|
28
|
-
onUnmounted(() => {
|
|
29
|
-
subscribersIds.forEach(id => service.unsubscribe(id));
|
|
30
|
-
subscribersIds.length = 0;
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
const fetch = async () => {
|
|
34
|
-
fetching.value = true;
|
|
35
|
-
try {
|
|
36
|
-
fetched.value = await service.getCurrent();
|
|
37
|
-
}
|
|
38
|
-
finally {
|
|
39
|
-
fetching.value = false;
|
|
40
|
-
}
|
|
41
|
-
subscribersIds.push(service.subscribe("all", onEntityChanged(fetched)));
|
|
42
|
-
return fetched;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return {
|
|
46
|
-
fetching,
|
|
47
|
-
fetch,
|
|
48
|
-
fetched
|
|
49
|
-
}
|
|
50
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { onUnmounted, ref } from "vue";
|
|
2
|
-
|
|
3
|
-
import { LayoutPageDetails, LayoutPageDetailsDTO } from "@dative-gpi/foundation-shared-domain/models";
|
|
4
|
-
import { onEntityChanged, ServiceFactory } from "@dative-gpi/bones-ui";
|
|
5
|
-
|
|
6
|
-
import { LAYOUT_PAGE_CURRENT_URL } from "../../config/urls";
|
|
7
|
-
|
|
8
|
-
const LayoutPageServiceFactory = new ServiceFactory<LayoutPageDetailsDTO, LayoutPageDetails>("layoutPage", LayoutPageDetails).create(factory => factory.build(
|
|
9
|
-
factory.addNotify((notifyService) => ({
|
|
10
|
-
getCurrent: async (): Promise<LayoutPageDetails> => {
|
|
11
|
-
const response = await ServiceFactory.http.get(LAYOUT_PAGE_CURRENT_URL());
|
|
12
|
-
const result = new LayoutPageDetails(response.data);
|
|
13
|
-
|
|
14
|
-
notifyService.notify("update", result);
|
|
15
|
-
|
|
16
|
-
return result;
|
|
17
|
-
}
|
|
18
|
-
}))
|
|
19
|
-
));
|
|
20
|
-
|
|
21
|
-
export const useCurrentLayoutPage = () => {
|
|
22
|
-
const service = LayoutPageServiceFactory();
|
|
23
|
-
const subscribersIds: number[] = [];
|
|
24
|
-
|
|
25
|
-
const fetching = ref(false);
|
|
26
|
-
const fetched = ref<LayoutPageDetails | null>(null);
|
|
27
|
-
|
|
28
|
-
onUnmounted(() => {
|
|
29
|
-
subscribersIds.forEach(id => service.unsubscribe(id));
|
|
30
|
-
subscribersIds.length = 0;
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
const fetch = async () => {
|
|
34
|
-
fetching.value = true;
|
|
35
|
-
try {
|
|
36
|
-
fetched.value = await service.getCurrent();
|
|
37
|
-
}
|
|
38
|
-
finally {
|
|
39
|
-
fetching.value = false;
|
|
40
|
-
}
|
|
41
|
-
subscribersIds.push(service.subscribe("all", onEntityChanged(fetched)));
|
|
42
|
-
return fetched;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return {
|
|
46
|
-
fetching,
|
|
47
|
-
fetch,
|
|
48
|
-
fetched
|
|
49
|
-
}
|
|
50
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { onUnmounted, ref } from "vue";
|
|
2
|
-
|
|
3
|
-
import { LegalInformationDetails, LegalInformationDetailsDTO } from "@dative-gpi/foundation-shared-domain/models";
|
|
4
|
-
import { onEntityChanged, ServiceFactory } from "@dative-gpi/bones-ui";
|
|
5
|
-
|
|
6
|
-
import { LEGAL_INFORMATION_CURRENT_URL } from "../../config/urls";
|
|
7
|
-
|
|
8
|
-
const LegalInformationServiceFactory = new ServiceFactory<LegalInformationDetailsDTO, LegalInformationDetails>("legalInformation", LegalInformationDetails).create(factory => factory.build(
|
|
9
|
-
factory.addNotify((notifyService) => ({
|
|
10
|
-
getCurrent: async (): Promise<LegalInformationDetails> => {
|
|
11
|
-
const response = await ServiceFactory.http.get(LEGAL_INFORMATION_CURRENT_URL());
|
|
12
|
-
const result = new LegalInformationDetails(response.data);
|
|
13
|
-
|
|
14
|
-
notifyService.notify("update", result);
|
|
15
|
-
|
|
16
|
-
return result;
|
|
17
|
-
}
|
|
18
|
-
}))
|
|
19
|
-
));
|
|
20
|
-
|
|
21
|
-
export const useCurrentLegalInformation = () => {
|
|
22
|
-
const service = LegalInformationServiceFactory();
|
|
23
|
-
const subscribersIds: number[] = [];
|
|
24
|
-
|
|
25
|
-
const fetching = ref(false);
|
|
26
|
-
const fetched = ref<LegalInformationDetails | null>(null);
|
|
27
|
-
|
|
28
|
-
onUnmounted(() => {
|
|
29
|
-
subscribersIds.forEach(id => service.unsubscribe(id));
|
|
30
|
-
subscribersIds.length = 0;
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
const fetch = async () => {
|
|
34
|
-
fetching.value = true;
|
|
35
|
-
try {
|
|
36
|
-
fetched.value = await service.getCurrent();
|
|
37
|
-
}
|
|
38
|
-
finally {
|
|
39
|
-
fetching.value = false;
|
|
40
|
-
}
|
|
41
|
-
subscribersIds.push(service.subscribe("all", onEntityChanged(fetched)));
|
|
42
|
-
return fetched;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return {
|
|
46
|
-
fetching,
|
|
47
|
-
fetch,
|
|
48
|
-
fetched
|
|
49
|
-
}
|
|
50
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { onUnmounted, ref } from "vue";
|
|
2
|
-
|
|
3
|
-
import { SecuritySettingDetails, SecuritySettingDetailsDTO } from "@dative-gpi/foundation-shared-domain/models";
|
|
4
|
-
import { onEntityChanged, ServiceFactory } from "@dative-gpi/bones-ui";
|
|
5
|
-
|
|
6
|
-
import { SECURITY_SETTING_CURRENT_URL } from "../../config/urls";
|
|
7
|
-
|
|
8
|
-
const SecuritySettingServiceFactory = new ServiceFactory<SecuritySettingDetailsDTO, SecuritySettingDetails>("securitySetting", SecuritySettingDetails).create(factory => factory.build(
|
|
9
|
-
factory.addNotify((notifyService) => ({
|
|
10
|
-
getCurrent: async (): Promise<SecuritySettingDetails> => {
|
|
11
|
-
const response = await ServiceFactory.http.get(SECURITY_SETTING_CURRENT_URL());
|
|
12
|
-
const result = new SecuritySettingDetails(response.data);
|
|
13
|
-
|
|
14
|
-
notifyService.notify("update", result);
|
|
15
|
-
|
|
16
|
-
return result;
|
|
17
|
-
}
|
|
18
|
-
}))
|
|
19
|
-
));
|
|
20
|
-
|
|
21
|
-
export const useCurrentSecuritySettings = () => {
|
|
22
|
-
const service = SecuritySettingServiceFactory();
|
|
23
|
-
const subscribersIds: number[] = [];
|
|
24
|
-
|
|
25
|
-
const fetching = ref(false);
|
|
26
|
-
const fetched = ref<SecuritySettingDetails | null>(null);
|
|
27
|
-
|
|
28
|
-
onUnmounted(() => {
|
|
29
|
-
subscribersIds.forEach(id => service.unsubscribe(id));
|
|
30
|
-
subscribersIds.length = 0;
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
const fetch = async () => {
|
|
34
|
-
fetching.value = true;
|
|
35
|
-
try {
|
|
36
|
-
fetched.value = await service.getCurrent();
|
|
37
|
-
}
|
|
38
|
-
finally {
|
|
39
|
-
fetching.value = false;
|
|
40
|
-
}
|
|
41
|
-
subscribersIds.push(service.subscribe("all", onEntityChanged(fetched)));
|
|
42
|
-
return fetched;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return {
|
|
46
|
-
fetching,
|
|
47
|
-
fetch,
|
|
48
|
-
fetched
|
|
49
|
-
}
|
|
50
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { onUnmounted, ref } from "vue";
|
|
2
|
-
|
|
3
|
-
import { CreateUserLegalInformationDTO, UserLegalInformationDetails, UserLegalInformationDetailsDTO } from "@dative-gpi/foundation-shared-domain/models";
|
|
4
|
-
import { ComposableFactory, onEntityChanged, ServiceFactory } from "@dative-gpi/bones-ui";
|
|
5
|
-
|
|
6
|
-
import { USER_LEGAL_INFORMATIONS_URL, USER_LEGAL_INFORMATION_CURRENT_URL } from "../../config/urls";
|
|
7
|
-
|
|
8
|
-
const UserLegalInformationServiceFactory = new ServiceFactory<UserLegalInformationDetailsDTO, UserLegalInformationDetails>("userLegalInformation", UserLegalInformationDetails).create(factory => factory.build(
|
|
9
|
-
factory.addCreate<CreateUserLegalInformationDTO>(USER_LEGAL_INFORMATIONS_URL),
|
|
10
|
-
factory.addNotify((notifyService) => ({
|
|
11
|
-
getCurrent: async (): Promise<UserLegalInformationDetails> => {
|
|
12
|
-
const response = await ServiceFactory.http.get(USER_LEGAL_INFORMATION_CURRENT_URL());
|
|
13
|
-
const result = new UserLegalInformationDetails(response.data);
|
|
14
|
-
|
|
15
|
-
notifyService.notify("update", result);
|
|
16
|
-
|
|
17
|
-
return result;
|
|
18
|
-
}
|
|
19
|
-
}))
|
|
20
|
-
));
|
|
21
|
-
|
|
22
|
-
export const useCreateUserLegalInformation = ComposableFactory.create(UserLegalInformationServiceFactory);
|
|
23
|
-
export const useCurrentUserLegalInformation = () => {
|
|
24
|
-
const service = UserLegalInformationServiceFactory();
|
|
25
|
-
const subscribersIds: number[] = [];
|
|
26
|
-
|
|
27
|
-
const fetching = ref(false);
|
|
28
|
-
const fetched = ref<UserLegalInformationDetails | null>(null);
|
|
29
|
-
|
|
30
|
-
onUnmounted(() => {
|
|
31
|
-
subscribersIds.forEach(id => service.unsubscribe(id));
|
|
32
|
-
subscribersIds.length = 0;
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
const fetch = async () => {
|
|
36
|
-
fetching.value = true;
|
|
37
|
-
try {
|
|
38
|
-
fetched.value = await service.getCurrent();
|
|
39
|
-
}
|
|
40
|
-
finally {
|
|
41
|
-
fetching.value = false;
|
|
42
|
-
}
|
|
43
|
-
subscribersIds.push(service.subscribe("all", onEntityChanged(fetched)));
|
|
44
|
-
return fetched;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return {
|
|
48
|
-
fetching,
|
|
49
|
-
fetch,
|
|
50
|
-
fetched
|
|
51
|
-
}
|
|
52
|
-
}
|