@saooti/octopus-sdk 38.3.13 → 38.3.15

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": "38.3.13",
3
+ "version": "38.3.15",
4
4
  "private": false,
5
5
  "description": "Javascript SDK for using octopus",
6
6
  "author": "Saooti",
@@ -12,7 +12,7 @@
12
12
  padding: 0.5rem 0 0;
13
13
  color: black;
14
14
  font-weight: bold;
15
- margin-bottom: 0.5rem;
15
+ margin-bottom: 0.2rem;
16
16
  }
17
17
  .counter-align-right{
18
18
  flex-grow: 1;
@@ -52,11 +52,12 @@ import { orgaComputed } from "../../mixins/orgaComputed";
52
52
  import octopusApi from "@saooti/octopus-api";
53
53
  import { useFilterStore } from "@/stores/FilterStore";
54
54
  import { useAuthStore } from "@/stores/AuthStore";
55
- import { mapState } from "pinia";
55
+ import { mapActions, mapState } from "pinia";
56
56
  import { state } from "../../../stores/ParamSdkStore";
57
57
  import { Conference } from "@/stores/class/conference/conference";
58
58
  import { defineComponent } from "vue";
59
59
  import { AxiosError } from "axios";
60
+ import { useSaveFetchStore } from "@/stores/SaveFetchStore";
60
61
  export default defineComponent({
61
62
  name: "LiveList",
62
63
  components: {
@@ -163,13 +164,13 @@ export default defineComponent({
163
164
  },
164
165
  },
165
166
  methods: {
167
+ ...mapActions(useSaveFetchStore, ["getOrgaLiveEnabled"]),
166
168
  async checkIfLiveAuthorized(): Promise<void> {
167
169
  if (!this.filterOrgaUsed) {
168
170
  return;
169
171
  }
170
- this.isLiveAuthorized = await octopusApi.fetchData<boolean>(
171
- 0,
172
- "organisation/liveEnabled/" + this.filterOrgaUsed,
172
+ this.isLiveAuthorized = await this.getOrgaLiveEnabled(
173
+ this.filterOrgaUsed,
173
174
  );
174
175
  },
175
176
  endLoading(): void {
@@ -37,7 +37,7 @@
37
37
 
38
38
  <script lang="ts">
39
39
  import { useAuthStore } from "@/stores/AuthStore";
40
- import { mapState } from "pinia";
40
+ import { mapActions, mapState } from "pinia";
41
41
  import imageProxy from "../../mixins/imageProxy";
42
42
  import selenium from "../../mixins/selenium";
43
43
  import { orgaComputed } from "../../mixins/orgaComputed";
@@ -48,6 +48,7 @@ import {
48
48
  emptyOrgaData,
49
49
  Organisation,
50
50
  } from "@/stores/class/general/organisation";
51
+ import { useSaveFetchStore } from "@/stores/SaveFetchStore";
51
52
  export default defineComponent({
52
53
  components: {
53
54
  ClassicMultiselect,
@@ -109,6 +110,7 @@ export default defineComponent({
109
110
  this.organisationChosen = this.getDefaultOrganisation;
110
111
  },
111
112
  methods: {
113
+ ...mapActions(useSaveFetchStore, ["getOrgaData"]),
112
114
  async onSearchOrganisation(query?: string): Promise<void> {
113
115
  const response = await octopusApi.fetchDataWithParams<{
114
116
  count: number;
@@ -145,9 +147,8 @@ export default defineComponent({
145
147
  ).afterSearch(notNullOrga, response.count);
146
148
  },
147
149
  async fetchOrganisation(): Promise<void> {
148
- this.organisationChosen = await octopusApi.fetchData<Organisation>(
149
- 0,
150
- `organisation/${this.orgaIdSelected}`,
150
+ this.organisationChosen = await this.getOrgaData(
151
+ this.orgaIdSelected ?? "",
151
152
  );
152
153
  this.initLoaded = true;
153
154
  },
@@ -27,7 +27,8 @@
27
27
 
28
28
  <script lang="ts">
29
29
  import { Organisation } from "@/stores/class/general/organisation";
30
- import octopusApi from "@saooti/octopus-api";
30
+ import { useSaveFetchStore } from "@/stores/SaveFetchStore";
31
+ import { mapActions } from "pinia";
31
32
  import { defineComponent } from "vue";
32
33
  export default defineComponent({
33
34
  props: {
@@ -64,6 +65,7 @@ export default defineComponent({
64
65
  },
65
66
 
66
67
  methods: {
68
+ ...mapActions(useSaveFetchStore, ["getOrgaData"]),
67
69
  onOrganisationSelected(): void {
68
70
  this.$emit(
69
71
  "selected",
@@ -74,12 +76,8 @@ export default defineComponent({
74
76
  if (!this.value) {
75
77
  return;
76
78
  }
77
- const data = await octopusApi.fetchData<Organisation>(
78
- 0,
79
- `organisation/${this.value}`,
80
- );
81
- this.organisation = data;
82
- this.actual = data.id;
79
+ this.organisation = await this.getOrgaData(this.value);
80
+ this.actual = this.organisation.id;
83
81
  this.init = true;
84
82
  },
85
83
  },
@@ -5,17 +5,15 @@ import { useFilterStore } from "@/stores/FilterStore";
5
5
  import { mapActions } from "pinia";
6
6
  import { defineComponent } from "vue";
7
7
  import { AxiosError } from "axios";
8
- import { Organisation } from "@/stores/class/general/organisation";
8
+ import { useSaveFetchStore } from "@/stores/SaveFetchStore";
9
9
  export default defineComponent({
10
10
  mixins: [handle403],
11
11
  methods: {
12
+ ...mapActions(useSaveFetchStore, ["getOrgaLiveEnabled", "getOrgaData"]),
12
13
  ...mapActions(useFilterStore, ["filterUpdateOrga"]),
13
14
  async selectOrganisation(organisationId: string): Promise<void> {
14
15
  try {
15
- const response = await octopusApi.fetchData<Organisation>(
16
- 0,
17
- `organisation/${organisationId}`,
18
- );
16
+ const response = await this.getOrgaData(organisationId);
19
17
  const data = await octopusApi.fetchDataWithParams<Array<Rubriquage>>(
20
18
  0,
21
19
  "rubriquage/find/" + organisationId,
@@ -25,10 +23,7 @@ export default defineComponent({
25
23
  },
26
24
  true,
27
25
  );
28
- const isLive = await octopusApi.fetchData<boolean>(
29
- 0,
30
- "organisation/liveEnabled/" + organisationId,
31
- );
26
+ const isLive = await this.getOrgaLiveEnabled(organisationId);
32
27
  this.filterUpdateOrga({
33
28
  orgaId: organisationId,
34
29
  imgUrl: response.imageUrl,
@@ -258,7 +258,10 @@ export default defineComponent({
258
258
  },
259
259
  podcastsFetched(podcasts: Array<Podcast>) {
260
260
  for (const podcast of podcasts) {
261
- if ("READY" === podcast.processingStatus && podcast.availability.visibility) {
261
+ if (
262
+ "READY" === podcast.processingStatus &&
263
+ podcast.availability.visibility
264
+ ) {
262
265
  this.lastPodcast = podcast;
263
266
  return;
264
267
  }
@@ -2,13 +2,18 @@
2
2
  import { defineStore } from 'pinia';
3
3
  import octopusApi from '@saooti/octopus-api';
4
4
  import { useAuthStore } from '@/stores/AuthStore';
5
+ import {Organisation} from "@/stores/class/general/organisation";
5
6
 
6
7
  interface SaveFetchState{
7
8
  orgaPublicAttributes: {[key:string]: {[key: string]:string|number|boolean|undefined}},
9
+ orgaLiveEnabled: {[key:string]: boolean},
10
+ orgaData: {[key:string]: Organisation},
8
11
  }
9
12
  export const useSaveFetchStore = defineStore('SaveFetchStore', {
10
13
  state: (): SaveFetchState => ({
11
- orgaPublicAttributes:{}
14
+ orgaPublicAttributes:{},
15
+ orgaLiveEnabled:{},
16
+ orgaData:{},
12
17
  }),
13
18
  actions:{
14
19
  async getOrgaAttributes(orgaId: string): Promise<{ [key: string]: string | number | boolean | undefined; }>{
@@ -25,6 +30,28 @@ export const useSaveFetchStore = defineStore('SaveFetchStore', {
25
30
  this.orgaPublicAttributes[orgaId] = await octopusApi.fetchData<{[key:string]:string}>(0, 'organisation/attributes/'+orgaId);
26
31
  }
27
32
  return this.orgaPublicAttributes[orgaId];
33
+ },
34
+ async getOrgaData(orgaId: string): Promise<Organisation>{
35
+ if(this.orgaData[orgaId]){
36
+ return this.orgaData[orgaId];
37
+ }
38
+ const authStore = useAuthStore();
39
+ if(orgaId === authStore.authOrganisation.id){
40
+ this.orgaData[orgaId] = authStore.authOrganisation;
41
+ }else{
42
+ this.orgaData[orgaId] = await octopusApi.fetchData<Organisation>(0, 'organisation/'+orgaId);
43
+ }
44
+ return this.orgaData[orgaId];
45
+ },
46
+ async getOrgaLiveEnabled(orgaId: string): Promise<boolean>{
47
+ if(!orgaId.length){
48
+ return false;
49
+ }
50
+ if(this.orgaLiveEnabled[orgaId]){
51
+ return this.orgaLiveEnabled[orgaId];
52
+ }
53
+ this.orgaLiveEnabled[orgaId] = await octopusApi.fetchData<boolean>(0, "organisation/liveEnabled/"+orgaId);
54
+ return this.orgaLiveEnabled[orgaId];
28
55
  }
29
56
  }
30
57
  })