Skip to content

Commit

Permalink
feat: fetch the cfm service version from the store file, not call the…
Browse files Browse the repository at this point in the history
… corresponding api (#20)
  • Loading branch information
Meng-20 authored Aug 7, 2024
1 parent c455076 commit cb0d6c2
Showing 1 changed file with 11 additions and 26 deletions.
37 changes: 11 additions & 26 deletions webui/src/components/Footer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,36 +18,21 @@
</template>

<script>
import { DefaultApi } from "@/axios/api";
import { BASE_PATH } from "@/axios/base";
import { computed } from "vue";
import packageJson from "/package.json";

// Use API_BASE_PATH to overwrite the BASE_PATH in the generated client code
const API_BASE_PATH = process.env.BASE_PATH || BASE_PATH;
import { useServiceStore } from "./Stores/ServiceStore";

export default {
data() {
return {
uiVersion: null, // Fetch from the package.json file
serviceVersion: null, // Fetch from cfm-service through API cfmV1Get
};
},
setup() {
const serviceStore = useServiceStore();
const serviceVersion = computed(() => serviceStore.serviceVersion);

mounted() {
this.getServiceVersion();
this.uiVersion = packageJson.version;
},
const uiVersion = packageJson.version;

methods: {
async getServiceVersion() {
try {
const defaultApi = new DefaultApi(undefined, API_BASE_PATH);
const response = await defaultApi.cfmV1Get();
this.serviceVersion = response.data.version;
} catch (error) {
console.error("Error fetching CFM Service version:", error);
}
},
return {
serviceVersion,
uiVersion,
};
},
};
</script>
</script>

0 comments on commit cb0d6c2

Please sign in to comment.