@saooti/octopus-sdk 37.0.23 → 37.0.25

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saooti/octopus-sdk",
3
- "version": "37.0.23",
3
+ "version": "37.0.25",
4
4
  "private": false,
5
5
  "description": "Javascript SDK for using octopus",
6
6
  "author": "Saooti",
@@ -2,14 +2,7 @@
2
2
  <ClassicRadio
3
3
  v-model:textInit="sort"
4
4
  id-radio="sort-radio"
5
- :options="[
6
- { title: $t('Sort score'), value: 'SCORE' },
7
- {
8
- title: $t('Sort last'),
9
- value: isEmission ? 'LAST_PODCAST_DESC' : 'DATE',
10
- },
11
- { title: $t('Sort name'), value: 'NAME' },
12
- ]"
5
+ :options="optionsArray"
13
6
  />
14
7
  </template>
15
8
 
@@ -31,6 +24,25 @@ export default defineComponent({
31
24
  sort: this.sortCriteria,
32
25
  };
33
26
  },
27
+ computed: {
28
+ optionsArray() {
29
+ let options = [
30
+ { title: this.$t("Sort score"), value: "SCORE" },
31
+ {
32
+ title: this.$t("Sort last"),
33
+ value: this.isEmission ? "LAST_PODCAST_DESC" : "DATE",
34
+ },
35
+ { title: this.$t("Sort name"), value: "NAME" },
36
+ ];
37
+ if (!this.isEmission) {
38
+ options.splice(2, 0, {
39
+ title: this.$t("Chronological"),
40
+ value: "DATE_ASC",
41
+ });
42
+ }
43
+ return options;
44
+ },
45
+ },
34
46
  watch: {
35
47
  sort(): void {
36
48
  this.$emit("updateSortCriteria", this.sort);
@@ -6,10 +6,8 @@
6
6
  v-if="!justSizeChosen"
7
7
  class="d-flex justify-content-between align-items-center flex-grow-1 w-100"
8
8
  >
9
- <div class="text-secondary">
10
- <template
11
- v-if="textCount && (windowWidth > 1300 || windowWidth <= 960)"
12
- >
9
+ <div class="text-secondary me-3">
10
+ <template v-if="textCount">
13
11
  {{ textCount }}
14
12
  </template>
15
13
  </div>
@@ -188,10 +188,13 @@ export default defineComponent({
188
188
  return state.generalParameters.podcastmaker as boolean;
189
189
  },
190
190
  date(): string {
191
- if (this.podcast && 1970 !== dayjs(this.podcast.pubDate).year()) {
192
- return dayjs(this.podcast.pubDate).format("D MMMM YYYY");
191
+ if (!this.podcast || 1970 === dayjs(this.podcast.pubDate).year()) {
192
+ return "";
193
193
  }
194
- return "";
194
+ if (this.isLiveReadyToRecord) {
195
+ return dayjs(this.podcast.pubDate).format("D MMMM YYYY - HH:mm");
196
+ }
197
+ return dayjs(this.podcast.pubDate).format("D MMMM YYYY");
195
198
  },
196
199
  duration(): string {
197
200
  if (!this.podcast || this.podcast.duration <= 1) return "";
@@ -261,7 +264,9 @@ export default defineComponent({
261
264
  },
262
265
  methods: {
263
266
  removeDeleted(): void {
264
- if (window.history.length > 1) {
267
+ if (this.isLiveReadyToRecord) {
268
+ this.$router.push("/main/pub/lives");
269
+ } else if (window.history.length > 1) {
265
270
  this.$router.go(-1);
266
271
  } else {
267
272
  this.$router.push("/");
@@ -25,11 +25,11 @@
25
25
  <script lang="ts">
26
26
  import ClassicCheckbox from "../../form/ClassicCheckbox.vue";
27
27
  import { state } from "../../../stores/ParamSdkStore";
28
- import octopusApi from "@saooti/octopus-api";
29
28
  import SnackBar from "../../misc/SnackBar.vue";
30
29
  import QrcodeVue from "qrcode.vue";
30
+ import { useSaveFetchStore } from "@/stores/SaveFetchStore";
31
31
  import { useAuthStore } from "@/stores/AuthStore";
32
- import { mapState } from "pinia";
32
+ import { mapState, mapActions } from "pinia";
33
33
  import { defineComponent } from "vue";
34
34
  export default defineComponent({
35
35
  name: "QrCode",
@@ -62,6 +62,7 @@ export default defineComponent({
62
62
  this.initColor();
63
63
  },
64
64
  methods: {
65
+ ...mapActions(useSaveFetchStore, ["getOrgaAttributes"]),
65
66
  download(): void {
66
67
  const link = document.createElement("a");
67
68
  link.download = "qrcode.png";
@@ -83,21 +84,13 @@ export default defineComponent({
83
84
  return;
84
85
  }
85
86
  if (!state.generalParameters.authenticated) return;
86
- let data;
87
- if (
88
- "" !== this.authOrganisation.id &&
89
- this.authOrganisation.attributes &&
90
- Object.keys(this.authOrganisation.attributes).length > 1
91
- ) {
92
- data = this.authOrganisation.attributes;
93
- } else {
94
- data = await octopusApi.fetchData<{ [key: string]: string }>(
95
- 0,
96
- "organisation/attributes/" + state.generalParameters.organisationId,
97
- );
98
- }
99
- if (Object.prototype.hasOwnProperty.call(data, "COLOR")) {
100
- this.otherColor = data.COLOR as string;
87
+ const orgaId =
88
+ "" !== this.authOrganisation.id
89
+ ? this.authOrganisation.id
90
+ : state.generalParameters.organisationId;
91
+ const attributes = await this.getOrgaAttributes(orgaId ?? "");
92
+ if (Object.prototype.hasOwnProperty.call(attributes, "COLOR")) {
93
+ this.otherColor = attributes.COLOR as string;
101
94
  }
102
95
  },
103
96
  },
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="module-box">
2
+ <div v-if="!isLoading && !noSharing" class="module-box">
3
3
  <div class="d-flex align-items-center mb-3">
4
4
  <h2 class="big-h2 mb-0">
5
5
  {{ $t("Share") }}
@@ -31,6 +31,8 @@
31
31
  </template>
32
32
 
33
33
  <script lang="ts">
34
+ import { useSaveFetchStore } from "@/stores/SaveFetchStore";
35
+ import { mapActions } from "pinia";
34
36
  import { Emission } from "@/stores/class/general/emission";
35
37
  import { Podcast } from "@/stores/class/general/podcast";
36
38
  import { state } from "../../../stores/ParamSdkStore";
@@ -52,10 +54,27 @@ export default defineComponent({
52
54
  participantId: { default: undefined, type: Number },
53
55
  organisationId: { default: undefined, type: String },
54
56
  },
57
+ data() {
58
+ return {
59
+ noSharing: true as boolean,
60
+ isLoading: true as boolean,
61
+ };
62
+ },
55
63
  computed: {
56
64
  authenticated(): boolean {
57
65
  return state.generalParameters.authenticated as boolean;
58
66
  },
59
67
  },
68
+ async created() {
69
+ if (!this.organisationId) {
70
+ return;
71
+ }
72
+ const attributes = await this.getOrgaAttributes(this.organisationId);
73
+ this.noSharing = "true" === attributes.noSharing;
74
+ this.isLoading = false;
75
+ },
76
+ methods: {
77
+ ...mapActions(useSaveFetchStore, ["getOrgaAttributes"]),
78
+ },
60
79
  });
61
80
  </script>
@@ -208,17 +208,17 @@ export default defineComponent({
208
208
  if (this.participantId) {
209
209
  return api + "participant/" + this.participantId + ".rss";
210
210
  }
211
- if (this.organisationId) {
212
- return api + "productor/" + this.organisationId + ".rss";
213
- }
214
211
  if (this.playlist) {
215
212
  return api + "playlist/" + this.playlist.playlistId + ".rss";
216
213
  }
214
+ if (this.organisationId) {
215
+ return api + "productor/" + this.organisationId + ".rss";
216
+ }
217
217
  return "";
218
218
  },
219
219
  },
220
220
  async created() {
221
- if (this.organisationId || this.participantId) {
221
+ if (undefined !== this.participantId) {
222
222
  this.displayRss = await octopusApi.fetchDataPublic<boolean>(
223
223
  0,
224
224
  `rss/participants/allowed/${this.organisationId}`,
@@ -90,12 +90,12 @@
90
90
  <script lang="ts">
91
91
  import { orgaComputed } from "../../mixins/orgaComputed";
92
92
  import { state } from "../../../stores/ParamSdkStore";
93
- import octopusApi from "@saooti/octopus-api";
94
93
  import { Podcast } from "@/stores/class/general/podcast";
95
94
  import { Emission } from "@/stores/class/general/emission";
96
95
  import { Playlist } from "@/stores/class/general/playlist";
97
96
  import { useAuthStore } from "@/stores/AuthStore";
98
- import { mapState } from "pinia";
97
+ import { useSaveFetchStore } from "@/stores/SaveFetchStore";
98
+ import { mapState, mapActions } from "pinia";
99
99
  import { defineComponent, defineAsyncComponent } from "vue";
100
100
  const ShareModalPlayer = defineAsyncComponent(
101
101
  () => import("../../misc/modal/ShareModalPlayer.vue"),
@@ -217,8 +217,11 @@ export default defineComponent({
217
217
  );
218
218
  },
219
219
  iFrameSrc(): string {
220
- if("video" === this.iFrameModel){
221
- return "//www.ultimedia.com/deliver/generic/iframe/mdtk/01009833/zone/1/showtitle/1/src/" + this.podcast?.video?.videoId
220
+ if ("video" === this.iFrameModel) {
221
+ return (
222
+ "//www.ultimedia.com/deliver/generic/iframe/mdtk/01009833/zone/1/showtitle/1/src/" +
223
+ this.podcast?.video?.videoId
224
+ );
222
225
  }
223
226
  let url = [""];
224
227
  let iFrameNumber =
@@ -246,22 +249,26 @@ export default defineComponent({
246
249
  },
247
250
  iFrameHeight(): string {
248
251
  switch (this.iFrameModel) {
249
- case 'video': return 'auto';
250
- case 'large':
251
- if (this.podcast) return '140px';
252
- return '350px';
253
- case 'largeMore':
254
- return '210px';
255
- case 'emissionLarge':
256
- case 'largeSuggestion':
257
- return '350px';
258
- case 'emission':return '520px';
252
+ case "video":
253
+ return "auto";
254
+ case "large":
255
+ if (this.podcast) return "140px";
256
+ return "350px";
257
+ case "largeMore":
258
+ return "210px";
259
+ case "emissionLarge":
260
+ case "largeSuggestion":
261
+ return "350px";
262
+ case "emission":
263
+ return "520px";
259
264
  default:
260
265
  return "530px";
261
266
  }
262
267
  },
263
268
  iFrame(): string {
264
- const specialDigiteka = this.podcast?.video?.videoId ? 'allowfullscreen="true" allow="autoplay" referrerpolicy="no-referrer-when-downgrade"' : '';
269
+ const specialDigiteka = this.podcast?.video?.videoId
270
+ ? 'allowfullscreen="true" allow="autoplay" referrerpolicy="no-referrer-when-downgrade"'
271
+ : "";
265
272
  return `<iframe src="${this.iFrameSrc}" width="100%" height="${this.iFrameHeight}" scrolling="no" frameborder="0" ${specialDigiteka}></iframe>`;
266
273
  },
267
274
  isPodcastNotVisible(): boolean {
@@ -290,13 +297,18 @@ export default defineComponent({
290
297
  },
291
298
  },
292
299
  async created() {
293
- await this.fetchOrgaAttributes();
300
+ const orgaId =
301
+ "" !== this.authOrganisation.id
302
+ ? this.authOrganisation.id
303
+ : state.generalParameters.organisationId;
304
+ this.orgaAttributes = await this.getOrgaAttributes(orgaId ?? "");
294
305
  this.initColor();
295
306
  if (this.isLiveReadyToRecord) {
296
307
  this.iFrameModel = "large";
297
308
  }
298
309
  },
299
310
  methods: {
311
+ ...mapActions(useSaveFetchStore, ["getOrgaAttributes"]),
300
312
  getIframeNumber(): string {
301
313
  return this.displayChoiceAllEpisodes && "all" === this.episodeNumbers
302
314
  ? "/0"
@@ -360,19 +372,6 @@ export default defineComponent({
360
372
  }
361
373
  return url;
362
374
  },
363
- async fetchOrgaAttributes(): Promise<void> {
364
- if (
365
- "" !== this.authOrganisation.id &&
366
- this.authOrganisation.attributes &&
367
- Object.keys(this.authOrganisation.attributes).length > 1
368
- ) {
369
- this.orgaAttributes = this.authOrganisation.attributes;
370
- } else {
371
- this.orgaAttributes = await octopusApi.fetchData<{
372
- [key: string]: string;
373
- }>(0, "organisation/attributes/" + this.myOrganisationId);
374
- }
375
- },
376
375
  initColor(): void {
377
376
  if (!this.orgaAttributes) {
378
377
  return;
@@ -34,9 +34,9 @@
34
34
  <script lang="ts">
35
35
  import { orgaComputed } from "../../mixins/orgaComputed";
36
36
  import { state } from "../../../stores/ParamSdkStore";
37
- import octopusApi from "@saooti/octopus-api";
37
+ import { useSaveFetchStore } from "@/stores/SaveFetchStore";
38
38
  import { useAuthStore } from "@/stores/AuthStore";
39
- import { mapState } from "pinia";
39
+ import { mapState, mapActions } from "pinia";
40
40
  import { defineComponent, defineAsyncComponent } from "vue";
41
41
  import { Canal } from "@/stores/class/radio/canal";
42
42
  const ShareModalPlayer = defineAsyncComponent(
@@ -81,23 +81,15 @@ export default defineComponent({
81
81
  },
82
82
  },
83
83
  async created() {
84
- await this.fetchOrgaAttributes();
84
+ const orgaId =
85
+ "" !== this.authOrganisation.id
86
+ ? this.authOrganisation.id
87
+ : state.generalParameters.organisationId;
88
+ this.orgaAttributes = await this.getOrgaAttributes(orgaId ?? "");
85
89
  this.initColor();
86
90
  },
87
91
  methods: {
88
- async fetchOrgaAttributes(): Promise<void> {
89
- if (
90
- "" !== this.authOrganisation.id &&
91
- this.authOrganisation.attributes &&
92
- Object.keys(this.authOrganisation.attributes).length > 1
93
- ) {
94
- this.orgaAttributes = this.authOrganisation.attributes;
95
- } else {
96
- this.orgaAttributes = await octopusApi.fetchData<{
97
- [key: string]: string;
98
- }>(0, "organisation/attributes/" + this.myOrganisationId);
99
- }
100
- },
92
+ ...mapActions(useSaveFetchStore, ["getOrgaAttributes"]),
101
93
  initColor(): void {
102
94
  if (!this.orgaAttributes) {
103
95
  return;
@@ -46,19 +46,41 @@ export default defineComponent({
46
46
  };
47
47
  },
48
48
  computed: {
49
- isVideoPodcast(): boolean{
50
- return undefined!==this.podcast && undefined!==this.podcast.video?.videoId;
49
+ isVideoPodcast(): boolean {
50
+ return (
51
+ undefined !== this.podcast && undefined !== this.podcast.video?.videoId
52
+ );
51
53
  },
52
54
  optionsSelect() {
53
55
  return [
54
- {name: this.$t('Video Version'), value: 'video', condition: this.isVideoPodcast},
55
- {name: this.$t('Default version'), value: 'default', condition: true},
56
- {name: this.$t('Large version'), value: 'large', condition: true},
57
- {name: this.$t('Full Large version'), value: 'largeMore', condition: this.podcast && this.podcast.podcastId},
58
- {name: this.$t('Emission version'), value: 'emission', condition: this.podcast && this.podcast.podcastId},
59
- {name: this.$t('Large emission version'), value: 'emissionLarge', condition: this.podcast && this.podcast.podcastId},
60
- {name: this.$t('Large suggestion version'), value: 'largeSuggestion', condition: this.podcast && this.podcast.podcastId}
61
- ]
56
+ {
57
+ name: this.$t("Video Version"),
58
+ value: "video",
59
+ condition: this.isVideoPodcast,
60
+ },
61
+ { name: this.$t("Default version"), value: "default", condition: true },
62
+ { name: this.$t("Large version"), value: "large", condition: true },
63
+ {
64
+ name: this.$t("Full Large version"),
65
+ value: "largeMore",
66
+ condition: this.podcast && this.podcast.podcastId,
67
+ },
68
+ {
69
+ name: this.$t("Emission version"),
70
+ value: "emission",
71
+ condition: this.podcast && this.podcast.podcastId,
72
+ },
73
+ {
74
+ name: this.$t("Large emission version"),
75
+ value: "emissionLarge",
76
+ condition: this.podcast && this.podcast.podcastId,
77
+ },
78
+ {
79
+ name: this.$t("Large suggestion version"),
80
+ value: "largeSuggestion",
81
+ condition: this.podcast && this.podcast.podcastId,
82
+ },
83
+ ];
62
84
  },
63
85
  customPlayersDisplay(): Array<CustomPlayer> {
64
86
  return this.customPlayers.filter((player: CustomPlayer) => {
@@ -75,8 +97,8 @@ export default defineComponent({
75
97
  },
76
98
  },
77
99
  async created() {
78
- if(this.isVideoPodcast){
79
- this.$emit("update:iFrameModel","video");
100
+ if (this.isVideoPodcast) {
101
+ this.$emit("update:iFrameModel", "video");
80
102
  }
81
103
  await this.initCustomPlayers();
82
104
  },
@@ -108,7 +130,7 @@ export default defineComponent({
108
130
  }
109
131
  this.customPlayers = this.customPlayers.concat(playersContent);
110
132
  if (
111
- 'video'!==this.iFrameModel &&
133
+ "video" !== this.iFrameModel &&
112
134
  trySelect &&
113
135
  this.customPlayers[0] &&
114
136
  this.customPlayers[0].selected
@@ -82,7 +82,7 @@ export default defineComponent({
82
82
  return this.range ? dayString + " - " + dayString : dayString;
83
83
  },
84
84
  now(): Date {
85
- if(this.dateLimit){
85
+ if (this.dateLimit) {
86
86
  return this.dateLimit;
87
87
  }
88
88
  return dayjs().toDate();
@@ -93,9 +93,9 @@ import { Participant } from "@/stores/class/general/participant";
93
93
  import { Podcast } from "@/stores/class/general/podcast";
94
94
  import { state } from "../../../stores/ParamSdkStore";
95
95
  import { defineComponent } from "vue";
96
+ import { useSaveFetchStore } from "@/stores/SaveFetchStore";
96
97
  import { useAuthStore } from "@/stores/AuthStore";
97
- import { mapState } from "pinia";
98
- import octopusApi from "@saooti/octopus-api";
98
+ import { mapState, mapActions } from "pinia";
99
99
  import { Emission } from "@/stores/class/general/emission";
100
100
  import { Playlist } from "@/stores/class/general/playlist";
101
101
  export default defineComponent({
@@ -290,6 +290,7 @@ export default defineComponent({
290
290
  this.initData();
291
291
  },
292
292
  methods: {
293
+ ...mapActions(useSaveFetchStore, ["getOrgaAttributes"]),
293
294
  closePopup(): void {
294
295
  this.$emit("close");
295
296
  },
@@ -309,19 +310,11 @@ export default defineComponent({
309
310
  );
310
311
  },
311
312
  async initData(): Promise<void> {
312
- let attributes;
313
- if (
314
- "" !== this.authOrganisation.id &&
315
- this.authOrganisation.attributes &&
316
- Object.keys(this.authOrganisation.attributes).length > 1
317
- ) {
318
- attributes = this.authOrganisation.attributes;
319
- } else {
320
- attributes = await octopusApi.fetchData<{ [key: string]: string }>(
321
- 0,
322
- "organisation/attributes/" + state.generalParameters.organisationId,
323
- );
324
- }
313
+ const orgaId =
314
+ "" !== this.authOrganisation.id
315
+ ? this.authOrganisation.id
316
+ : state.generalParameters.organisationId;
317
+ const attributes = await this.getOrgaAttributes(orgaId ?? "");
325
318
  if (Object.prototype.hasOwnProperty.call(attributes, "podcastmakerUrl")) {
326
319
  this.shareUrl =
327
320
  attributes.podcastmakerUrl +
@@ -83,7 +83,7 @@ export default defineComponent({
83
83
  this.handleResize(0);
84
84
  },
85
85
  methods: {
86
- displayEverythingAfterIndex(indexAsked: number){
86
+ displayEverythingAfterIndex(indexAsked: number) {
87
87
  for (let index = 0; index < this.playerRadioHistory.length; index++) {
88
88
  const el = (this.$refs["history" + index] as Array<HTMLElement>)[0];
89
89
  if (!el) continue;
@@ -41,6 +41,7 @@
41
41
  <ShareButtons
42
42
  v-if="pageParameters.isShareButtons"
43
43
  :emission="emission"
44
+ :organisation-id="emission.orga.id"
44
45
  />
45
46
  <SubscribeButtons
46
47
  v-if="pageParameters.isShareButtons && countLink >= 1"
@@ -36,6 +36,7 @@
36
36
  <ShareButtons
37
37
  v-if="pageParameters.isShareButtons"
38
38
  :playlist="playlist"
39
+ :organisation-id="playlist.organisation.id"
39
40
  />
40
41
  <PodcastList :playlist="playlist" />
41
42
  </div>
@@ -24,7 +24,11 @@
24
24
  :organisation-id="myOrganisationId"
25
25
  :is-education="isEducation"
26
26
  />
27
- <ShareButtons v-if="pageParameters.isShareButtons" :podcast="podcast" />
27
+ <ShareButtons
28
+ v-if="pageParameters.isShareButtons"
29
+ :podcast="podcast"
30
+ :organisation-id="podcast.organisation.id"
31
+ />
28
32
  <SubscribeButtons
29
33
  v-if="pageParameters.isShareButtons && countLink >= 1"
30
34
  :emission="podcast.emission"
@@ -25,7 +25,7 @@
25
25
  :canal="radio"
26
26
  :organisation-id="myOrganisationId"
27
27
  />
28
- <ShareButtons />
28
+ <ShareButtons :organisation-id="radio.organisationId" />
29
29
  </div>
30
30
  </template>
31
31
  <ClassicLoading
package/src/locale/de.ts CHANGED
@@ -346,4 +346,5 @@ export default {
346
346
  "Show only episodes with video":"Nur Episoden mit Video anzeigen",
347
347
  "Video":"Video",
348
348
  "Video Version":"Videoversion",
349
+ "Chronological":"Chronologisch",
349
350
  }
package/src/locale/en.ts CHANGED
@@ -346,4 +346,5 @@ export default {
346
346
  "Show only episodes with video":"Show only episodes with video",
347
347
  "Video":"Video",
348
348
  "Video Version":"Video version",
349
+ "Chronological":"Chronological",
349
350
  };
package/src/locale/es.ts CHANGED
@@ -347,4 +347,5 @@ export default {
347
347
  "Show only episodes with video":"Mostrar solo episodios con video",
348
348
  "Video":"Video",
349
349
  "Video Version":"Versión de vídeo",
350
+ "Chronological":"Cronológico",
350
351
  }
package/src/locale/fr.ts CHANGED
@@ -350,9 +350,8 @@ export default {
350
350
  "Display HTML":"Afficher HTML",
351
351
  "Video is unavailable":"La vidéo est indisponible",
352
352
  'Full Large version': 'Version en longueur complète',
353
-
354
-
355
353
  "Show only episodes with video":"Afficher uniquement les épisodes avec une vidéo",
356
354
  "Video":"Vidéo",
357
355
  "Video Version":"Version vidéo",
356
+ "Chronological":"Chronologique",
358
357
  };
package/src/locale/it.ts CHANGED
@@ -339,4 +339,5 @@ export default{
339
339
  "Show only episodes with video":"Mostra solo episodi con video",
340
340
  "Video":"Video",
341
341
  "Video Version":"Versione video",
342
+ "Chronological":"Cronologico",
342
343
  };
package/src/locale/sl.ts CHANGED
@@ -336,4 +336,5 @@ export default {
336
336
  "Show only episodes with video":"Prikaži samo epizode z videom",
337
337
  "Video":"Video",
338
338
  "Video Version":"Video različica",
339
+ "Chronological":"Kronološko",
339
340
  }
@@ -0,0 +1,27 @@
1
+
2
+ import { defineStore } from 'pinia';
3
+ import octopusApi from '@saooti/octopus-api';
4
+ import { useAuthStore } from '@/stores/AuthStore';
5
+
6
+ interface SaveFetchState{
7
+ orgaPublicAttributes: {[key:string]: {[key: string]:string|number|boolean|undefined}},
8
+ }
9
+ export const useSaveFetchStore = defineStore('SaveFetchStore', {
10
+ state: (): SaveFetchState => ({
11
+ orgaPublicAttributes:{}
12
+ }),
13
+ actions:{
14
+ async getOrgaAttributes(orgaId: string): Promise<{ [key: string]: string | number | boolean | undefined; }>{
15
+ if(this.orgaPublicAttributes[orgaId]){
16
+ return this.orgaPublicAttributes[orgaId];
17
+ }
18
+ const authStore = useAuthStore();
19
+ if(orgaId === authStore.authOrganisation.id && authStore.authOrganisation.attributes && Object.keys(authStore.authOrganisation.attributes).length > 1){
20
+ this.orgaPublicAttributes[orgaId] = authStore.authOrganisation.attributes;
21
+ }else{
22
+ this.orgaPublicAttributes[orgaId] = await octopusApi.fetchData<{[key:string]:string}>(0, 'organisation/attributes/'+orgaId);
23
+ }
24
+ return this.orgaPublicAttributes[orgaId];
25
+ }
26
+ }
27
+ })