viewPunishment.ts 523 B

12345678910111213141516171819202122232425
  1. import { defineStore } from "pinia";
  2. export const useViewPunishmentStore = props => {
  3. const { modalUuid } = props;
  4. if (!modalUuid) return null;
  5. return defineStore(`viewPunishment-${modalUuid}`, {
  6. state: () => ({
  7. punishmentId: null,
  8. punishment: {
  9. _id: null
  10. }
  11. }),
  12. actions: {
  13. init({ punishmentId }) {
  14. this.punishmentId = punishmentId;
  15. },
  16. viewPunishment(punishment) {
  17. this.punishment = punishment;
  18. },
  19. deactivatePunishment() {
  20. this.punishment.active = false;
  21. }
  22. }
  23. })();
  24. };