mirror of
https://github.com/Fabio286/antares.git
synced 2025-06-05 21:59:22 +02:00
refactor: migration to pinia
This commit is contained in:
@ -29,10 +29,11 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapActions, mapGetters } from 'vuex';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { useApplicationStore } from '@/stores/application';
|
||||
import ConfirmModal from '@/components/BaseConfirmModal';
|
||||
import TextEditor from '@/components/BaseTextEditor';
|
||||
import { useScratchpadStore } from '@/stores/scratchpad';
|
||||
|
||||
export default {
|
||||
name: 'TheScratchpad',
|
||||
@ -43,8 +44,16 @@ export default {
|
||||
emits: ['hide'],
|
||||
setup () {
|
||||
const applicationStore = useApplicationStore();
|
||||
const scratchpadStore = useScratchpadStore();
|
||||
|
||||
return { hideScratchpad: applicationStore.hideScratchpad };
|
||||
const { notes } = storeToRefs(scratchpadStore);
|
||||
const { changeNotes } = scratchpadStore;
|
||||
|
||||
return {
|
||||
notes,
|
||||
hideScratchpad: applicationStore.hideScratchpad,
|
||||
changeNotes
|
||||
};
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
@ -52,11 +61,6 @@ export default {
|
||||
debounceTimeout: null
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
notes: 'scratchpad/getNotes'
|
||||
})
|
||||
},
|
||||
watch: {
|
||||
localNotes () {
|
||||
clearTimeout(this.debounceTimeout);
|
||||
@ -70,9 +74,6 @@ export default {
|
||||
this.localNotes = this.notes;
|
||||
},
|
||||
methods: {
|
||||
...mapActions({
|
||||
changeNotes: 'scratchpad/changeNotes'
|
||||
}),
|
||||
hideModal () {
|
||||
this.$emit('hide');
|
||||
}
|
||||
|
Reference in New Issue
Block a user