All files / src/store/features/playbook/slices copyPlaybook.ts

18.18% Statements 2/11
0% Branches 0/2
0% Functions 0/1
10% Lines 1/10

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20      1x                                
import { PayloadAction } from "@reduxjs/toolkit";
import { PlaybookUIState } from "../../../../types/index.ts";
 
export const copyPlaybook = (
  state: PlaybookUIState,
  { payload }: PayloadAction<any>,
) => {
  const { useState, pb, isTemplate } = payload;
  Iif (useState) {
    state.currentPlaybook!.name = "Copy of " + state.currentPlaybook!.name;
    state.currentPlaybook!.ui_requirement.isExisting = false;
    return;
  }
  state.currentPlaybook = pb;
  state.currentPlaybook!.ui_requirement.isExisting = false;
  Iif (!isTemplate) {
    state.currentPlaybook!.name = "Copy of " + pb.name;
  }
};