nrg51098 / pinterest

This is pinterest mockup for the NSS exercise week 12
0 stars 0 forks source link

smashDelete #20

Open nrg51098 opened 4 years ago

nrg51098 commented 4 years ago

User Story

As a user, I should be able to delete the pin and also clearing from other table dependensies.

Dev Notes

Given A developer navigated to your repo There should see a file called smashDelete.js at following location src/javascripts/components/data/smashDelete.js this file should contain code to import dependensies as shown below

import pinData from './pinData';
import boardData from './boardData';

In this function we are trying to delete the pin with removing all the dependensies. This is example code.

const totallyRemovePin = (pin_id) => new Promise((resolve, reject) => {
  pinData.deletePin(pin_id)
    .then(() => {
      // get all board with pin_Id
      boardData.getBoardByPinId(pin_id).then((boards) => {
        boards.forEach((board) => {
          boardData.deleteBoard(myBoard.id);
        });
        resolve();
      });
      // delete each of the board
    })
    .catch((err) => reject(err));
});