Skip to content

Commit

Permalink
Merge pull request #256 from bcgov/migrate-to-vite
Browse files Browse the repository at this point in the history
Migrate multiple vuex stores to pinia
  • Loading branch information
esune authored Jan 28, 2025
2 parents 2234d49 + 49927df commit 2aa729d
Show file tree
Hide file tree
Showing 28 changed files with 884 additions and 732 deletions.
5 changes: 3 additions & 2 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import { Component, Vue } from "vue-property-decorator";
import Header from "@/components/layout/header/Header.vue";
import Footer from "@/components/layout/footer/Footer.vue";
import Loading from "@/components/shared/Loading.vue";
import { mapGetters } from "vuex";
import { useAppState } from "@/stores/app"
import { mapState } from "pinia";
@Component({
components: {
Expand All @@ -23,7 +24,7 @@ import { mapGetters } from "vuex";
Loading,
},
computed: {
...mapGetters(["loading"]),
...mapState(useAppState, {loading: "getLoading"}),
},
})
export default class App extends Vue {}
Expand Down
13 changes: 7 additions & 6 deletions src/components/contact/ContactForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,13 @@
<script lang="ts">
import { Component, Vue } from "vue-property-decorator";
import { mapActions, mapGetters } from "vuex";
import { useAppState, useContactState } from "@/stores"
import { mapActions as pmapActions, mapState } from "pinia";
import router from "@/router";
import { ICredentialType } from "@/interfaces/api/v2/credential-type.interface";
import { IContactRequest } from "@/interfaces/api/v4/contact.interface";
import { contactReason } from "@/store/modules/contact";
import { contactReason } from "@/stores/contact";
import { unwrapTranslations } from "@/utils/entity";
interface Data {
Expand Down Expand Up @@ -158,10 +161,8 @@ export default {
};
},
methods: {
...mapActions({
setLoading: "setLoading",
sendContact: "sendContact"
}),
...pmapActions(useAppState, ["setLoading"]),
...pmapActions(useContactState, ["sendContact"]),
async submit(e: Event): Promise<void> {
e.preventDefault();
const isFormValid = (
Expand All @@ -188,10 +189,10 @@ export default {
},
computed: {
...mapGetters({
loading: "loading",
credentialTypes: "credentialTypes",
getLikeStatus: "getLikeStatus"
}),
...mapState(useAppState, {loading: "getLoading"}),
requestTypes: function(): Array<{ text: string; value: string }> {
return Object.keys(contactReason).map((key) => ({
text: contactReason[key],
Expand Down
4 changes: 3 additions & 1 deletion src/components/entity/CredentialItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@
import { Component, Prop, Vue } from "vue-property-decorator";
import "@/filters/date.filter";
import { mapGetters } from "vuex";
import { mapState } from "pinia";
import { useTopicState } from "@/stores";
import { ICredentialDisplayType } from "@/interfaces/api/v4/credential.interface";
import { selectFirstAttrItem } from "@/utils/attribute";
import i18n from "@/i18n/index";
Expand All @@ -115,9 +117,9 @@ import { isExpired, toTranslationFormat } from "@/utils/entity";
...mapGetters([
"mdiOpenInNew",
"mdiShieldCheckOutline",
"selectedTopic",
"credentialTypes",
]),
...mapState(useTopicState, ["selectedTopic"])
},
})
export default class CredentialItem extends Vue {
Expand Down
Loading

0 comments on commit 2aa729d

Please sign in to comment.