<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Hilton Meyer</title>
    <description>The latest articles on DEV Community by Hilton Meyer (@iarehilton).</description>
    <link>https://dev.to/iarehilton</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F172409%2F8adc6c46-9dbc-4927-8f86-78140034a8ce.png</url>
      <title>DEV Community: Hilton Meyer</title>
      <link>https://dev.to/iarehilton</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/iarehilton"/>
    <language>en</language>
    <item>
      <title>Logout User</title>
      <dc:creator>Hilton Meyer</dc:creator>
      <pubDate>Mon, 19 Apr 2021 07:15:00 +0000</pubDate>
      <link>https://dev.to/iarehilton/logout-user-2j28</link>
      <guid>https://dev.to/iarehilton/logout-user-2j28</guid>
      <description>&lt;p&gt;&lt;em&gt;Code for this can be found in the &lt;a href="https://github.com/bikingbadger/pantry/tree/11-auth-logout" rel="noopener noreferrer"&gt;Github Branch&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The final step in wrapping up auth before getting back to the &lt;a href="https://hiltonmeyer.com/articles/series/pantry/articles/series/pantry/3-ingredients.html" rel="noopener noreferrer"&gt;ingredients&lt;/a&gt; form is being able to log a user out of the application. Again firebase does the heavy lifting and all we need to do is make sure our state is updated.&lt;/p&gt;

&lt;h3&gt;
  
  
  Store &lt;a href="https://hiltonmeyer.com/articles/series/pantry/11-auth-logout.html#store" rel="noopener noreferrer"&gt;#&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;The store needs to be refactored and updated after I noticed a few issues. The first is that the user details can be stored as an Object for easier use in the app called &lt;code&gt;currentUser&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;store/auth/authIndex.js&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import authActions from './authActions.js';
import authMutations from './authMutations';
import authGetters from './authGetters';

export default {
  namespaced: true,
  state() {
    return {
      currentUser: { id: 0, username: '', email: '' },
      registrationError: false,
      isLoggedIn: false,
      errorMsg: '',
    };
  },
  mutations: authMutations,
  actions: authActions,
  getters: authGetters,
};

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Below you can see the use of firebase to sign out the user from the system. The snippet below is without the full code for register and login. Take a look at the repo for full code.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;store/auth/authActions.js&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import firebase from '@/firebase.js';

const userRef = firebase.firestore().collection('/user');

export default {
  async register({ commit }, user) {
    ...
  },
  async login({ commit }, user) {
    ...
  },
  async logout({ commit }) {
    await firebase.auth().signOut();
    commit('logout');
  },
};

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Our mutation now has to update the state of the user being logged out. I also refactor the currentUser data in both the &lt;code&gt;logout&lt;/code&gt; and &lt;code&gt;authSuccess&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;store/auth/authMutations.js&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import router from '@/router';

export default {
  authSuccess(state, user) {
    state.currentUser.id = user.uid;
    state.currentUser.email = user.email;
    state.currentUser.username = user.username;
    state.registrationError = false;
    state.isLoggedIn = true;
    state.errorMsg = '';
    router.push({ name: 'home' });
  },
  authFail(state, error) {
    state.registrationError = true;
    state.isLoggedIn = false;
    state.errorMsg = error.message;
  },
  logout(state) {
    state.isLoggedIn = false;
    state.currentUser.id = null;
    state.currentUser.email = null;
    state.currentUser.username = null;
    router.replace({ name: 'home' });
  },
};

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Implement &lt;a href="https://hiltonmeyer.com/articles/series/pantry/11-auth-logout.html#implement" rel="noopener noreferrer"&gt;#&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;With this done we complete the logout functionality and now just need to use the action after clicking the button.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;components/ui/TheHeader.vue&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;template&amp;gt;
  &amp;lt;img
    alt="App logo"
    src="https://res.cloudinary.com/hiltonmeyer-com/image/upload/v1611488325/pantry/cooking-robot_xdaw7k.png"
  /&amp;gt;
  &amp;lt;div id="nav"&amp;gt;
    &amp;lt;router-link to="/"&amp;gt;Home&amp;lt;/router-link&amp;gt;
    &amp;lt;router-link v-if="isLoggedIn" to="/ingredients"&amp;gt; Ingredients&amp;lt;/router-link&amp;gt;
  &amp;lt;/div&amp;gt;
  &amp;lt;div id="auth"&amp;gt;
    &amp;lt;router-link v-if="!isLoggedIn" to="/login" tag="button"&amp;gt;
      &amp;lt;button&amp;gt;Login&amp;lt;/button&amp;gt;
    &amp;lt;/router-link&amp;gt;
    &amp;lt;router-link v-if="!isLoggedIn" to="/register"&amp;gt;
      &amp;lt;button&amp;gt;Register&amp;lt;/button&amp;gt;
    &amp;lt;/router-link&amp;gt;
    &amp;lt;button v-if="isLoggedIn" @click.prevent="logout"&amp;gt;Logout&amp;lt;/button&amp;gt;
  &amp;lt;/div&amp;gt;
&amp;lt;/template&amp;gt;

&amp;lt;script&amp;gt;
import { mapGetters, mapActions } from 'vuex';

export default {
  computed: {
    ...mapGetters('auth', ['isLoggedIn']),
  },
  methods: {
    ...mapActions('auth', ['logout']),
  },
};
&amp;lt;/script&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>vue</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>firebase</category>
    </item>
    <item>
      <title>Login form</title>
      <dc:creator>Hilton Meyer</dc:creator>
      <pubDate>Thu, 08 Apr 2021 07:48:00 +0000</pubDate>
      <link>https://dev.to/iarehilton/login-form-32ln</link>
      <guid>https://dev.to/iarehilton/login-form-32ln</guid>
      <description>&lt;p&gt;&lt;em&gt;Code for this can be found in the &lt;a href="https://github.com/bikingbadger/pantry/tree/10-login-form"&gt;Github Branch&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This form is pretty much the same as the &lt;a href="https://dev.to/iarehilton/register-form-k45"&gt;registration form&lt;/a&gt; so could be am interesting to look at using slots and refactoring the form. But as it stands I just want to get the login working so that I can start adding ingredients and at least creating a shopping list which would be the first milestone.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;views/Login.vue&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;template&amp;gt;
  &amp;lt;div&amp;gt;
    &amp;lt;label for="email"&amp;gt;Email&amp;lt;/label&amp;gt;
    &amp;lt;input type="email" name="email" id="email" v-model="email" /&amp;gt;
  &amp;lt;/div&amp;gt;
  &amp;lt;div&amp;gt;
    &amp;lt;label for="password"&amp;gt;Password&amp;lt;/label&amp;gt;
    &amp;lt;input type="password" name="password" id="password" v-model="password" /&amp;gt;
  &amp;lt;/div&amp;gt;
  &amp;lt;button @click="loginUser"&amp;gt;Login&amp;lt;/button&amp;gt;
&amp;lt;/template&amp;gt;

&amp;lt;script&amp;gt;
import { mapActions } from 'vuex';

export default {
  data() {
    return {
      email: '',
      password: '',
    };
  },
  methods: {
    ...mapActions('auth', ['login']),
    loginUser() {
      const userData = {
        email: this.email,
        password: this.password,
      };

      this.login(userData);
    },
  },
};
&amp;lt;/script&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Header component &lt;a href="https://hiltonmeyer.com/articles/series/pantry/10-login-form.html#header-component"&gt;#&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;Lets connect that up with some navigation and show when the user is actually logged in. the first thing is to extract the header into a separate component that will make changes easier and keep the main &lt;code&gt;App.vue&lt;/code&gt; file cleaner. I created a file in a new directory under components, &lt;code&gt;components/ui/TheHeader.vue&lt;/code&gt;. This naming is in line with the style guide of naming components using multiple words and using &lt;em&gt;The&lt;/em&gt; for components that will only be used once. Read more about this guideline in the &lt;a href="https://v3.vuejs.org/style-guide/#multi-word-component-names-essential"&gt;Vue Style Guide&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;components/ui/TheHeader.vue&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;template&amp;gt;
  &amp;lt;img
    alt="App logo"
    src="https://res.cloudinary.com/hiltonmeyer-com/image/upload/v1611488325/pantry/cooking-robot_xdaw7k.png"
  /&amp;gt;
  &amp;lt;div id="nav"&amp;gt;
    &amp;lt;router-link to="/"&amp;gt;Home&amp;lt;/router-link&amp;gt;
    &amp;lt;router-link v-if="isLoggedIn" to="/ingredients"&amp;gt; Ingredients&amp;lt;/router-link&amp;gt;
  &amp;lt;/div&amp;gt;
  &amp;lt;div id="auth"&amp;gt;
    &amp;lt;router-link v-if="!isLoggedIn" to="/login" tag="button"&amp;gt;
      &amp;lt;button&amp;gt;Login&amp;lt;/button&amp;gt;
    &amp;lt;/router-link&amp;gt;
    &amp;lt;router-link v-if="!isLoggedIn" to="/register"&amp;gt;
      &amp;lt;button&amp;gt;Register&amp;lt;/button&amp;gt;
    &amp;lt;/router-link&amp;gt;
    &amp;lt;button v-if="isLoggedIn" @click.prevent="logout"&amp;gt;Logout&amp;lt;/button&amp;gt;
  &amp;lt;/div&amp;gt;
&amp;lt;/template&amp;gt;

&amp;lt;script&amp;gt;
import { mapGetters } from 'vuex';

export default {
  computed: {
    ...mapGetters('auth', ['isLoggedIn']),
  },
};
&amp;lt;/script&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Routing &lt;a href="https://hiltonmeyer.com/articles/series/pantry/10-login-form.html#routing"&gt;#&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;To get the router links working and also to show whether the user in logged in I added the login view to the vue router setup and also added another bit of state to vuex as you can see in the below files.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;router/index.js&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  {
    path: '/login',
    name: 'login',
    component: () =&amp;gt; import('../views/Login.vue'),
  },

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Store &lt;a href="https://hiltonmeyer.com/articles/series/pantry/10-login-form.html#store"&gt;#&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;This takes care of showing the form when the button is clicked for either the register or the login button is pressed. For keen eye's I have already added the logout button although that currently does nothing and we'll handle that in an upcoming article. The next step is to show various links and buttons based on whether the user is logged in or not. I used the &lt;code&gt;mapGetters&lt;/code&gt; method of loading the getters of the vuex state which we add as follows.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;store/auth/authMutations.js&lt;/code&gt; I added &lt;code&gt;isLoggedIn&lt;/code&gt; state&lt;/p&gt;

&lt;p&gt;&lt;em&gt;store/auth/authMutations.js&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import router from '@/router';

export default {
  authSuccess(state, user) {
    console.log(state, user);
    state.email = user.email;
    state.username = user.username;
    state.registrationError = false;
    state.isLoggedIn = true;
    state.errorMsg = '';
    router.push({ path: 'home' });
  },
  authFail(state, error) {
    state.registrationError = true;
    state.isLoggedIn = true;
    state.errorMsg = error.message;
  },
};

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;store/auth/authIndex.js&lt;/code&gt; I added &lt;code&gt;isLoggedIn&lt;/code&gt; state and set it to &lt;code&gt;false&lt;/code&gt; by default&lt;/p&gt;

&lt;p&gt;&lt;em&gt;store/auth/authIndex.js&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import authActions from './authActions.js';
import authMutations from './authMutations';
import authGetters from './authGetters';

export default {
  namespaced: true,
  state() {
    return {
      id: 0,
      username: '',
      email: '',
      registrationError: false,
      isLoggedIn: false,
      errorMsg: '',
    };
  },
  mutations: authMutations,
  actions: authActions,
  getters: authGetters,
};

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;store/auth/authGetters.js&lt;/code&gt; returns the &lt;code&gt;isLoggedIn&lt;/code&gt; state&lt;/p&gt;

&lt;p&gt;&lt;em&gt;store/auth/authGetters.js&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export default {
  isLoggedIn(state) {
    return state.isLoggedIn;
  },
};

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Using the new component &lt;a href="https://hiltonmeyer.com/articles/series/pantry/10-login-form.html#using-the-new-component"&gt;#&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;With this new state in place and the component extracted this leaves the &lt;code&gt;App.vue&lt;/code&gt; file needing to import and use the component&lt;/p&gt;

&lt;p&gt;&lt;em&gt;App.vue&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;template&amp;gt;
  &amp;lt;the-header /&amp;gt;
  &amp;lt;router-view /&amp;gt;
&amp;lt;/template&amp;gt;

&amp;lt;script&amp;gt;
import TheHeader from '@/components/ui/TheHeader.vue';
export default {
  components: {
    TheHeader,
  },
};
&amp;lt;/script&amp;gt;

&amp;lt;style&amp;gt;
:root {
  --clr-neutral-500: #2c3e50;

  --clr-accent-500: #00b8f0;
}

#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: var(--clr-neutral-500);
}

img {
  display: block;
  margin: 0 auto;
}

#nav {
  padding: 30px;
  text-align: center;
}

#nav a {
  font-weight: bold;
  color: var(--clr-neutral-500);
}

#nav a.router-link-exact-active {
  color: var(--clr-accent-500);
}
&amp;lt;/style&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With that the auth is almost complete. The next step will be to add a logout functionality.&lt;/p&gt;

</description>
      <category>vue</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>firebase</category>
    </item>
    <item>
      <title>Login user using firebase</title>
      <dc:creator>Hilton Meyer</dc:creator>
      <pubDate>Thu, 01 Apr 2021 10:10:00 +0000</pubDate>
      <link>https://dev.to/iarehilton/login-user-using-firebase-1331</link>
      <guid>https://dev.to/iarehilton/login-user-using-firebase-1331</guid>
      <description>&lt;p&gt;&lt;em&gt;Code for this can be found in the &lt;a href="https://github.com/bikingbadger/pantry/tree/9-auth-login"&gt;Github Branch&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In the vuex &lt;a href="https://dev.to/iarehilton/register-user-to-firebase-4n5e"&gt;auth store&lt;/a&gt; all that needs to be done is add the login functionality. The great thing about using actions for asynchronous functions and let the mutations handle the state changes is as you can see in this case the mutation is the same whether the user registered or logged in for both success or failure. So firebase does all the heavy lifting of handling the auth which is a world unto its own and we just manage the state using Vuex. The application will then reflect the current state.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import firebase from '@/firebase.js';

const userRef = firebase.firestore().collection('/user');

export default {
  async register({ commit }, user) {
    try {
      // Register user
      const registered = await firebase
        .auth()
        .createUserWithEmailAndPassword(user.email, user.password);
      console.log(registered);

      // Create userdata
      const userData = {
        id: registered.user.uid,
        username: user.username,
        email: user.email,
      };

      // Save user to DB
      const createUser = await userRef.add(userData);
      commit('authSuccess', createUser);
    } catch (err) {
      commit('authFail', err);
    }
  },
  async login({ commit }, user) {
    try {
      const loggedIn = await firebase
        .auth()
        .signInWithEmailAndPassword(user.email, user.password);
      console.log(loggedIn);

      const userData = {
        id: loggedIn.user.uid,
        username: user.username,
        email: user.email,
      };

      commit('authSuccess', userData);
    } catch (err) {
      commit('authFail', err);
    }
  },
};

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The next step will be to add a login form similar to the &lt;a href="https://dev.to/iarehilton/register-form-k45"&gt;registration form&lt;/a&gt; and then start creating checks on the routing.&lt;/p&gt;

</description>
      <category>vue</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>firebase</category>
    </item>
    <item>
      <title>Sticky Headings</title>
      <dc:creator>Hilton Meyer</dc:creator>
      <pubDate>Sun, 21 Mar 2021 11:40:00 +0000</pubDate>
      <link>https://dev.to/iarehilton/sticky-headings-2pgf</link>
      <guid>https://dev.to/iarehilton/sticky-headings-2pgf</guid>
      <description>&lt;p&gt;Came across a great &lt;a href="https://christianheilmann.com/2021/02/09/using-position-sticky-to-create-persistent-headers-in-long-texts/"&gt;article&lt;/a&gt; showing how to create a sticky heading. Really simple and love little additions like this that don't require a ton of changes and can be added as some sparkles to tweak the site. Probably not useful in every site but I must say that they are in something like a blog where you're creating content or tutorials and have the heading still showing.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/* Create stick headings */
h1,
h2,
h3,
h4 {
  letter-spacing: -1px;
  position: sticky;
  top: 0;
  background: var(--background);
  padding: 0.5em 0;
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>css</category>
    </item>
    <item>
      <title>Register form</title>
      <dc:creator>Hilton Meyer</dc:creator>
      <pubDate>Sun, 21 Mar 2021 06:34:00 +0000</pubDate>
      <link>https://dev.to/iarehilton/register-form-k45</link>
      <guid>https://dev.to/iarehilton/register-form-k45</guid>
      <description>&lt;p&gt;&lt;em&gt;Code for this can be found in the &lt;a href="https://github.com/bikingbadger/pantry/tree/8-register-form"&gt;Github Branch&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This is a continuation from the registration functionality that I &lt;a href="https://dev.to/iarehilton/register-user-to-firebase-4n5e"&gt;setup up in Vuex&lt;/a&gt;. This post will now create a simple form for registering the user in firebase using that function.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;src/views/Register.vue&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;template&amp;gt;
  &amp;lt;div&amp;gt;
    &amp;lt;label for="username"&amp;gt;Username&amp;lt;/label&amp;gt;
    &amp;lt;input type="text" name="username" id="username" v-model="username" /&amp;gt;
  &amp;lt;/div&amp;gt;
  &amp;lt;div&amp;gt;
    &amp;lt;label for="email"&amp;gt;Email&amp;lt;/label&amp;gt;
    &amp;lt;input type="email" name="email" id="email" v-model="email" /&amp;gt;
  &amp;lt;/div&amp;gt;
  &amp;lt;div&amp;gt;
    &amp;lt;label for="password"&amp;gt;Password&amp;lt;/label&amp;gt;
    &amp;lt;input type="password" name="password" id="password" v-model="password" /&amp;gt;
  &amp;lt;/div&amp;gt;
  &amp;lt;button @click="registerUser"&amp;gt;Register&amp;lt;/button&amp;gt;
&amp;lt;/template&amp;gt;

&amp;lt;script&amp;gt;
import { mapActions } from 'vuex';

export default {
  data() {
    return {
      username: '',
      email: '',
      password: '',
    };
  },
  methods: {
    ...mapActions('auth', ['register']),
    registerUser() {
      const userData = {
        username: this.username,
        email: this.email,
        password: this.password,
      };

      this.register(userData);
    },
  },
};
&amp;lt;/script&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Other than the standard Vue features I'm using there is a cool little use of the spread operator and one of Vuex's best features. Instead of having to have to try and traverse the context and state I use &lt;code&gt;mapActions&lt;/code&gt;. This is then added to the methods and I can use is as a normal method in the file. Pretty cool. This will register the user and on success re-direct the user back to the homepage.&lt;/p&gt;

</description>
      <category>vue</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>firebase</category>
    </item>
    <item>
      <title>Register user to firebase</title>
      <dc:creator>Hilton Meyer</dc:creator>
      <pubDate>Fri, 12 Mar 2021 13:00:00 +0000</pubDate>
      <link>https://dev.to/iarehilton/register-user-to-firebase-4n5e</link>
      <guid>https://dev.to/iarehilton/register-user-to-firebase-4n5e</guid>
      <description>&lt;p&gt;&lt;em&gt;Code for this can be found in the &lt;a href="https://github.com/bikingbadger/pantry/tree/7-auth-register"&gt;Github Branch&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Organise Firebase &lt;a href="https://hiltonmeyer.com/articles/series/pantry/7-auth-register.html#organise-firebase"&gt;#&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;After &lt;a href="https://dev.to/iarehilton/setup-firebase-5b85"&gt;previously&lt;/a&gt; setting up firebase and vuex I want to organise things a bit better and then add login and registration of users. So first I extract the firebase setup to a separate file, this enables me to use it in other parts of the app and then to also import this into main and use it in the app.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;firebase.js&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import firebase from 'firebase/app';
import 'firebase/auth';
import 'firebase/firestore';

const firebaseConfig = {
  apiKey: 'AIzaSyDbYPvxMaECPwjgR06njRfTLFa_skZ9-Qo',
  authDomain: 'pantry-fe77c.firebaseapp.com',
  databaseURL: 'https://pantry-fe77c-default-rtdb.firebaseio.com',
  projectId: 'pantry-fe77c',
  storageBucket: 'pantry-fe77c.appspot.com',
  messagingSenderId: '235929136377',
  appId: '1:235929136377:web:f4687227f50dc7bd76c628',
  measurementId: 'G-7J6VBCW3SE',
};

firebase.initializeApp(firebaseConfig);

export default firebaseConfig;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You'll notice that I also added the &lt;code&gt;auth&lt;/code&gt; package to the import so that we can use this feature too as well as the &lt;code&gt;firestore&lt;/code&gt; so that we can save data later. I like to also setup and user table when registering so that in the future settings on the user can be saved there.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;main.js&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { createApp } from 'vue';
import App from './App.vue';
import router from './router';
import store from './store';
import firebase from './firebase.js';

let app;

firebase.authDomain().onAuthStateChanged(() =&amp;gt; {
  if (!app) {
    app = createApp(App);

    app.use(firebase);
    app.use(store);
    app.use(router);

    app.mount('#app');
  }
});

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;main.js&lt;/code&gt; file is cleaned up and I import the firebase settings.&lt;/p&gt;

&lt;h2&gt;
  
  
  Register Action and Mutation &lt;a href="https://hiltonmeyer.com/articles/series/pantry/7-auth-register.html#register-action-and-mutation"&gt;#&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Let's setup the registration option now and then connect it to a register form. First thing is to add state to the module of the extra user information that we want to save for now.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;authIndex.js&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import authActions from './authActions.js';
import authMutations from './authMutations';
import authGetters from './authGetters';

export default {
  namespaced: true,
  state() {
    return {
      id: 0,
      username: '',
      email: '',
      registrationError: false,
      errorMsg: '',
    };
  },
  mutations: authMutations,
  actions: authActions,
  getters: authGetters,
};

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now for the action that does the asynchronous calls before passing on the data to the mutation that does the work to save the state. This separation of concerns help to keep state valid and consistent.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;authActions.js&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import firebase from '@/firebase.js';

const userRef = firebase.firestore().collection('/user');

export default {
  async register({ commit }, user) {
    try {
      // Register user using email and password
      const registered = await firebase
        .auth()
        .createUserWithEmailAndPassword(user.email, user.password);
      console.log(registered);

      // Create userdata
      const userData = {
        id: registered.user.uid,
        username: user.username,
        email: user.email,
      };

      // Save user to DB
      const createUser = await userRef.add(userData);
      commit('authSuccess', createUser);
    } catch (err) {
        commit('authFail', err);
    }
  },
};

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This user is first created using firebase auth so that we can get the user token for future validation. The next step is to then take that user and save it with the extra data. Once done we can send the data to the mutation using &lt;code&gt;commit&lt;/code&gt; or if there is an error we again send the error along to the mutation for later showing the error.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;authMutations.js&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import router from '@/router';

export default {
  authSuccess(state, user) {
    console.log(state, user);
    state.email = user.email;
    state.username = user.username;
    state.registrationError = false;
    state.errorMsg = '';
    router.push({ path: 'home' });
  },
  authFail(state, error) {
    state.registrationError = true;
    state.errorMsg = error.message;
  },
};

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With that we have the registration functionality setup. In the next post I'll create a registration form and hook that up to the vuex store.&lt;/p&gt;

</description>
      <category>vue</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>firebase</category>
    </item>
    <item>
      <title>Add Vuex</title>
      <dc:creator>Hilton Meyer</dc:creator>
      <pubDate>Fri, 05 Mar 2021 10:19:00 +0000</pubDate>
      <link>https://dev.to/iarehilton/add-vuex-3mpn</link>
      <guid>https://dev.to/iarehilton/add-vuex-3mpn</guid>
      <description>&lt;p&gt;&lt;em&gt;Code for this can be found in the &lt;a href="https://github.com/bikingbadger/pantry/tree/6-vuex"&gt;Github Branch&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This is a short one but will lay the foundation for saving ingredients, recipes and any other state of the app.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;vue add vuex

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once the package has been installed you should see a new folder called &lt;code&gt;store&lt;/code&gt; under &lt;code&gt;src&lt;/code&gt;. In &lt;code&gt;main.js&lt;/code&gt; the file will also be imported and used by the App. I like to break my modules up in separate folders that hold each store and I name space them but more of this shortly. In the store directory I create a new folder called &lt;code&gt;auth&lt;/code&gt;. Within this folder I have 4 files&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;authIndex.js&lt;/li&gt;
&lt;li&gt;authActions.js&lt;/li&gt;
&lt;li&gt;authMutation.js&lt;/li&gt;
&lt;li&gt;authGetters.js&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is probably huge overkill for now but later on and as the project grows it just makes it easier to handle. For now the only files I'll flesh out in &lt;code&gt;authIndex.js&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import authActions from './authActions.js';
import authMutations from './authMutations';
import authGetters from './authGetters';

export default {
  namespaced: true,
  state: {},
  mutations: {
    authMutations,
  },
  actions: {
    authActions,
  },
  getters: {
    authGetters,
  },
};

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And then import the module into the &lt;code&gt;store/index.js&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { createStore } from 'vuex';

import authModule from './auth/authIndex';

export default createStore({
  state: {},
  mutations: {},
  actions: {},
  modules: { auth: authModule },
});

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The skeleton of the store is ready for handling the next thing to tackle which is login and registration of a user. That way we can manage the router paths of what users can do while logged in and also what they can only read when not.&lt;/p&gt;

</description>
      <category>vue</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>firebase</category>
    </item>
    <item>
      <title>Setup Firebase</title>
      <dc:creator>Hilton Meyer</dc:creator>
      <pubDate>Mon, 01 Mar 2021 04:30:00 +0000</pubDate>
      <link>https://dev.to/iarehilton/setup-firebase-5b85</link>
      <guid>https://dev.to/iarehilton/setup-firebase-5b85</guid>
      <description>&lt;p&gt;&lt;em&gt;Code for this can be found in the &lt;a href="https://github.com/bikingbadger/pantry/tree/5-firebase" rel="noopener noreferrer"&gt;Github Branch&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;There is a bit of a chicken or the egg situation now. I guess I could start with getting my state managed in Vuex setup first although I prefer to get the DB setup so that I can use it. I'm going for &lt;a href="https://console.firebase.google.com/" rel="noopener noreferrer"&gt;Firebase&lt;/a&gt; to give me a quick solution for setting up a database and also later adding auth in one place. So let's go ahead and install and initialize firebase&lt;/p&gt;

&lt;h2&gt;
  
  
  Setup &lt;a href="https://hiltonmeyer.com/articles/series/pantry/4-firebase.html#setup" rel="noopener noreferrer"&gt;#&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;The first thing is going over to Firebase console and setting up a new project. Once done you want to add the new application that you want to give access to your Firebase project. Select Project Overview and then select &lt;code&gt;+Add app&lt;/code&gt; and select web app&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fhiltonmeyer-com%2Fimage%2Fupload%2Ff_auto%2Cq_auto%2Cc_scale%2Cw_auto%2Cdpr_auto%2Fv1612524026%2Fhiltonmeyer.com%2Fpantry-005_vwachm.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fhiltonmeyer-com%2Fimage%2Fupload%2Ff_auto%2Cq_auto%2Cc_scale%2Cw_auto%2Cdpr_auto%2Fv1612524026%2Fhiltonmeyer.com%2Fpantry-005_vwachm.jpg" alt="Add App"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fhiltonmeyer-com%2Fimage%2Fupload%2Ff_auto%2Cq_auto%2Cc_scale%2Cw_auto%2Cdpr_auto%2Fv1612524026%2Fhiltonmeyer.com%2Fpantry-006_mxbdpt.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fhiltonmeyer-com%2Fimage%2Fupload%2Ff_auto%2Cq_auto%2Cc_scale%2Cw_auto%2Cdpr_auto%2Fv1612524026%2Fhiltonmeyer.com%2Fpantry-006_mxbdpt.jpg" alt="Web App"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After that you give the application a name and it will create the app and provide the SDK config required when initializing the app. Save that data and we'll add it to the &lt;code&gt;main.js&lt;/code&gt; file soon to get things up and running with Firebase initialized.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fhiltonmeyer-com%2Fimage%2Fupload%2Fv1612524026%2Fhiltonmeyer.com%2Fpantry-007_jbre2z.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fhiltonmeyer-com%2Fimage%2Fupload%2Fv1612524026%2Fhiltonmeyer.com%2Fpantry-007_jbre2z.jpg" alt="App name"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fhiltonmeyer-com%2Fimage%2Fupload%2Fv1612524026%2Fhiltonmeyer.com%2Fpantry-008_skrqrn.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fhiltonmeyer-com%2Fimage%2Fupload%2Fv1612524026%2Fhiltonmeyer.com%2Fpantry-008_skrqrn.jpg" alt="Config"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Installing Firebase SDK with NPM is done as follows&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install firebase

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once installed in my main file I will initialize Firebase using the config file created for this app.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { createApp } from 'vue';
import App from './App.vue';
import router from './router';
import firebase from 'firebase/app';

// Initialize Firebase
const firebaseConfig = {
  apiKey: 'AIzaSyDbYPvxMaECPwjgR06njRfTLFa_skZ9-Qo',
  authDomain: 'pantry-fe77c.firebaseapp.com',
  databaseURL: 'https://pantry-fe77c-default-rtdb.firebaseio.com',
  projectId: 'pantry-fe77c',
  storageBucket: 'pantry-fe77c.appspot.com',
  messagingSenderId: '235929136377',
  appId: '1:235929136377:web:23a498fc887466ce76c628',
  measurementId: 'G-S4ER2JYTKZ',
};
firebase.initializeApp(firebaseConfig);

createApp(App)
  .use(router)
  .mount('#app');

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With this we can now use firebase in the application. So let's add a method for getting and posting the ingredients to the DB&lt;/p&gt;

</description>
      <category>vue</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>firebase</category>
    </item>
    <item>
      <title>Creating components</title>
      <dc:creator>Hilton Meyer</dc:creator>
      <pubDate>Fri, 19 Feb 2021 12:10:00 +0000</pubDate>
      <link>https://dev.to/iarehilton/creating-components-10</link>
      <guid>https://dev.to/iarehilton/creating-components-10</guid>
      <description>&lt;p&gt;&lt;em&gt;Code for this can be found in the &lt;a href="https://github.com/bikingbadger/pantry/tree/4-creating-components"&gt;Github Branch&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Things are going to start increasing in size and one of the cool things about Vue is using components. So the first thing I want to do is create a directory in &lt;code&gt;src&lt;/code&gt; called &lt;code&gt;components/ingredient&lt;/code&gt;, this will be where I add all my ingredient related components. This is just the way that I've decided to go but you could have something else or a different layout. Again I'm learning as I go along here and trying to share that with you as I pick up new things or better ways of doing things. If all goes according to plan I would come back and update these files not with the correct way but rather a link to the new way of doing it. I still want others to see the process which I find sometimes missing in these polished tutorials.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir src/components/ingredient
touch src/components/ingredient/AddIngredient.vue

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With this done I create a file called &lt;code&gt;AddIngredient.vue&lt;/code&gt; and add what we previously did &lt;a href="https://dev.to/iarehilton/setup-ingredients-m80"&gt;setting up the ingredient&lt;/a&gt; view cut that all out and paste it into the new file.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;AddIngredient.vue&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;template&amp;gt;
  &amp;lt;div class="ingredient"&amp;gt;
    &amp;lt;div class="add-ingredient-frm"&amp;gt;
      &amp;lt;div&amp;gt;
        &amp;lt;label for="name"&amp;gt;Name:&amp;lt;/label&amp;gt;
        &amp;lt;input type="text" name="name" id="name" /&amp;gt;
      &amp;lt;/div&amp;gt;
      &amp;lt;div&amp;gt;
        &amp;lt;label for="category"&amp;gt;Category:&amp;lt;/label&amp;gt;
        &amp;lt;select id="category" name="category"&amp;gt;
          &amp;lt;option value="legumes"&amp;gt;Legumes&amp;lt;/option&amp;gt;
          &amp;lt;option value="vegetables"&amp;gt;Vegetables&amp;lt;/option&amp;gt;
          &amp;lt;option value="fruit"&amp;gt;Fruit&amp;lt;/option&amp;gt;
          &amp;lt;option value="dairy"&amp;gt;Dairy&amp;lt;/option&amp;gt;
        &amp;lt;/select&amp;gt;
      &amp;lt;/div&amp;gt;
      &amp;lt;div&amp;gt;
        &amp;lt;label for="uom"&amp;gt;Unit of Measure:&amp;lt;/label&amp;gt;
        &amp;lt;input type="text" name="uom" id="uom" /&amp;gt;
      &amp;lt;/div&amp;gt;
      &amp;lt;div&amp;gt;&amp;lt;button&amp;gt;Add&amp;lt;/button&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;ul&amp;gt;
      &amp;lt;li&amp;gt;Milk&amp;lt;/li&amp;gt;
      &amp;lt;li&amp;gt;Whole wheat flour&amp;lt;/li&amp;gt;
      &amp;lt;li&amp;gt;Olive Oil&amp;lt;/li&amp;gt;
    &amp;lt;/ul&amp;gt;
  &amp;lt;/div&amp;gt;
&amp;lt;/template&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In &lt;code&gt;Ingredients.vue&lt;/code&gt; in the &lt;code&gt;views&lt;/code&gt; directory we import the newly created component and add it to the view we're using. This will get us back to where we were in the begining but with the added benefit of having broken up the code a bit and starting to use components.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Ingredients.vue&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;template&amp;gt;
  &amp;lt;add-ingredient&amp;gt;&amp;lt;/add-ingredient&amp;gt;
&amp;lt;/template&amp;gt;

&amp;lt;script&amp;gt;
import AddIngredient from '@/components/ingredient/AddIngredient.vue';

export default {
  components: { AddIngredient },
};
&amp;lt;/script&amp;gt;

&amp;lt;style&amp;gt;&amp;lt;/style&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>vue</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>firebase</category>
    </item>
    <item>
      <title>Customize Bullet Style</title>
      <dc:creator>Hilton Meyer</dc:creator>
      <pubDate>Thu, 18 Feb 2021 08:41:00 +0000</pubDate>
      <link>https://dev.to/iarehilton/customize-bullet-style-4n5d</link>
      <guid>https://dev.to/iarehilton/customize-bullet-style-4n5d</guid>
      <description>&lt;p&gt;A quick way to customize a bullet style instead of having to use &lt;code&gt;:before&lt;/code&gt; and content or twisting yourself in knot's.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;li::marker {
  font-size: 150%;
  font-weight: bold;
  color: lightgreen;
}

li::marker {
  font-size: 0.7em;
  color: fuchsia;
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>css</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Setup ingredients</title>
      <dc:creator>Hilton Meyer</dc:creator>
      <pubDate>Wed, 17 Feb 2021 06:36:00 +0000</pubDate>
      <link>https://dev.to/iarehilton/setup-ingredients-m80</link>
      <guid>https://dev.to/iarehilton/setup-ingredients-m80</guid>
      <description>&lt;p&gt;&lt;em&gt;Code for this can be found in the &lt;a href="https://github.com/bikingbadger/pantry/tree/3-add-ingredient"&gt;Github Branch&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Change About &lt;a href="https://hiltonmeyer.com/articles/series/pantry/3-ingredients.html#change-about"&gt;#&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;In order to add ingredients we'll need a form, I'm thinking that with this form I should be able to setup a shopping list as a first milestone for the project. There is an about page that I'm not really sure that I'll be using so instead of deleting it I'll re-purpose it for the form to add ingredients and show the current list of ingredients.&lt;/p&gt;

&lt;h2&gt;
  
  
  App.vue &lt;a href="https://hiltonmeyer.com/articles/series/pantry/3-ingredients.html#app.vue"&gt;#&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;In &lt;code&gt;App.vue&lt;/code&gt; I change the router-link from&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;router-link to="/about"&amp;gt;About&amp;lt;/router-link&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;to&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;router-link to="/ingredients"&amp;gt;Ingredients&amp;lt;/router-link&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Router &lt;a href="https://hiltonmeyer.com/articles/series/pantry/3-ingredients.html#router"&gt;#&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Next thing is setting the router so again I change the &lt;code&gt;router/index.js&lt;/code&gt; from&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    path: '/about',
    name: 'About',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () =&amp;gt; import(/* webpackChunkName: "about" */ '../views/About.vue')
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;to&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    path: '/ingredients',
    name: 'Ingredients',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () =&amp;gt; import(/* webpackChunkName: "about" */ '../views/Ingredients.vue')
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Ingredient Form &lt;a href="https://hiltonmeyer.com/articles/series/pantry/3-ingredients.html#ingredient-form"&gt;#&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;For now I just want the layout of the form for being able to show a list of ingredients and the ability to add ingredients that are missing.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;template&amp;gt;
  &amp;lt;div class="ingredient"&amp;gt;
    &amp;lt;div class="add-ingredient-frm"&amp;gt;
      &amp;lt;div&amp;gt;
        &amp;lt;label for="name"&amp;gt;Name:&amp;lt;/label&amp;gt;
        &amp;lt;input type="text" name="name" id="name" /&amp;gt;
      &amp;lt;/div&amp;gt;
      &amp;lt;div&amp;gt;
        &amp;lt;label for="category"&amp;gt;Category:&amp;lt;/label&amp;gt;
        &amp;lt;select id="category" name="category"&amp;gt;
          &amp;lt;option value="legumes"&amp;gt;Legumes&amp;lt;/option&amp;gt;
          &amp;lt;option value="vegetables"&amp;gt;Vegetables&amp;lt;/option&amp;gt;
          &amp;lt;option value="fruit"&amp;gt;Fruit&amp;lt;/option&amp;gt;
          &amp;lt;option value="dairy"&amp;gt;Dairy&amp;lt;/option&amp;gt;
        &amp;lt;/select&amp;gt;
      &amp;lt;/div&amp;gt;
      &amp;lt;div&amp;gt;
        &amp;lt;label for="uom"&amp;gt;Unit of Measure:&amp;lt;/label&amp;gt;
        &amp;lt;input type="text" name="uom" id="uom" /&amp;gt;
      &amp;lt;/div&amp;gt;
      &amp;lt;div&amp;gt;&amp;lt;button&amp;gt;Add&amp;lt;/button&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;ul&amp;gt;
      &amp;lt;li&amp;gt;Milk&amp;lt;/li&amp;gt;
      &amp;lt;li&amp;gt;Whole wheat flour&amp;lt;/li&amp;gt;
      &amp;lt;li&amp;gt;Olive Oil&amp;lt;/li&amp;gt;
    &amp;lt;/ul&amp;gt;
  &amp;lt;/div&amp;gt;
&amp;lt;/template&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Kq9e8VaY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/hiltonmeyer-com/image/upload/f_auto%2Cq_auto%2Cc_scale%2Cw_auto%2Cdpr_auto/v1611929567/hiltonmeyer.com/pantry-004_hovn32.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Kq9e8VaY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/hiltonmeyer-com/image/upload/f_auto%2Cq_auto%2Cc_scale%2Cw_auto%2Cdpr_auto/v1611929567/hiltonmeyer.com/pantry-004_hovn32.jpg" alt="Ingredient Form"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Next steps &lt;a href="https://hiltonmeyer.com/articles/series/pantry/3-ingredients.html#next-steps"&gt;#&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;The next thing that I want to do is be able to add an ingredient and save it to a database and the other would be to show those ingredients on the list. After that a search feature would be cool and then being able to add the ingredients to a shopping list which will already have the first milestone and allow me to start using the app for my weekly shopping.&lt;/p&gt;

</description>
      <category>vue</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>firebase</category>
    </item>
    <item>
      <title>CSS Reset</title>
      <dc:creator>Hilton Meyer</dc:creator>
      <pubDate>Wed, 17 Feb 2021 06:30:00 +0000</pubDate>
      <link>https://dev.to/iarehilton/css-reset-25lc</link>
      <guid>https://dev.to/iarehilton/css-reset-25lc</guid>
      <description>&lt;p&gt;After doing a the &lt;a href="https://cssdemystified.com/"&gt;CSS Demystified&lt;/a&gt; CSS course of &lt;a href="https://www.kevinpowell.co/"&gt;Kevin Powel&lt;/a&gt; I left with a much better understanding of CSS although far from where I want to be and coming from a development side of thigs my design chops need some serious work. At the moment I love &lt;a href="https://tailwindcss.com/"&gt;Tailwind&lt;/a&gt; although more and more lately &lt;a href="https://watercss.kognise.dev/"&gt;WaterCSS&lt;/a&gt; drop in stylesheet. But for me to start working and learning I'll have to start working on CSS and not depending on others. The base is where everything starts off with so I will use this as a page that I will come back to as I build out my CSS reset for projects.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;:root {
  --ff-sans: 'IBM Plex Sans', sans-serif;
  --ff-serif: 'IBM Plex Serif', serif;

  /* small screen font-sizes */
  --fs-200: 0.75rem;
  --fs-300: 1rem;
  --fs-400: 1.25rem;
  --fs-500: 1.375rem;
  --fs-600: 1.75rem;
  --fs-900: 2.125rem;

  --fw-200: 200;
  --fw-300: 300;
  --fw-400: 400;
  --fw-700: 700;

  --clr-neutral-100: #fff;
  --clr-neutral-200: #eef1f6;
  --clr-neutral-300: #a9afbc;
  --clr-neutral-400: #737b8c;
  --clr-neutral-500: #434956;
  --clr-neutral-900: #020203;

  --clr-primary-300: #f3f7ff;
  --clr-primary-400: #8ea8da;

  --br: 1rem;

  --lh-heading: 1rem;
  --lh-text: 1.5rem;
}

/* Reset */

*,
*::before,
*::after {
  box-sizing: border-box;
}

h1,
h2,
h3,
h4,
.h1,
.h2,
.h3,
.h4 {
  line-height: var(--lh-heading);
}

* {
  margin: 0;
  padding: 0;
}

ul[class],
ol[class] {
  list-style: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Layout */

body {
  padding: 1rem;
  line-height: var(--lh-text);
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>css</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
