nss-evening-cohort-11 / nutshell-ewoks-droids

Star Destroyer
0 stars 2 forks source link

Weapons Create #17

Closed Nikababy01 closed 4 years ago

Nikababy01 commented 4 years ago

USER STORY

As a user, I should be able to create a Weapon.

AC

WHEN the page loads I should see the weapons THEN click a button
AND add a new weapon

WIREFRAMES

image image

DEV NOTES


1. In weapons.js create a function to add a new weapon:
    const makeNewWeapon = (e) => {
     e.preventDefault();
     const newWeapon = {
      name: $('#new-weapon-name').val(),
     description: $('#weapon-description).val(),
      };
      weaponsData.addWeapons(newWeapon)
      .then(()= > {
      buildWeaponsCards();
      utils.printToDom('newWeapon', '')
     })
   .catch((err) => console.error('could not add weapon', err));
 };

1. Create a bootstrap button
2.  In weaponsData.js :
import axios from 'axios';
import apiKeys from '../apiKeys.json';
3. add a function to post to firebase:
   const addWeapons = (newWeapon) => axios.post(`baseUrl}/weapons/.json`, newWeapon);

RELATED TICKETS

EX. #4