home.social

#vuex — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #vuex, aggregated by home.social.

  1. ICYMI - Coding Short from the Vault:

    Coding Shorts: Pinia for 3: A Better ?

    youtube.com/watch?v=izQ9mYLuTOM

  2. ICYMI - Coding Short from the Vault:

    Coding Shorts: Pinia for 3: A Better ?

    youtube.com/watch?v=izQ9mYLuTOM

  3. Пишем морской бой на VueJS и Python

    Напишем всем известную игру на VueJS, Python и вебсокетах. Можно будет поиграть со случайным соперником и попробовать свои силы с другом.

    habr.com/ru/articles/874188/

    #vuejs #python #fastapi #websocket #canvas #разработка_игр #морской_бой #typescript #vuex #javascript

  4. This past autumn, I started playing around with the Composition API, and at the October 2023 Hack and Tell, I put that knowledge into writing a “Job Tracker“.  The job tracker used Vuex and Firebase Authentication to log a user in using their Google credentials.  With const store = useStore() on your view, you can do something like Welcome, {{user.data.displayName}} but using this technique you can also use …

    const LoginWithGoogle = async () => {
    try {
    await store.dispatch('loginWithGoogle')
    router.push('/')
    }
    catch (err) {
    error.value = err.message
    }
    }

    … to kick off the authentication of the user.  I want to use it to finally finish the State Parks app but I also want to use Pinia instead of Vuex, I wanted the resulting app to be a PWA, and I wanted to allow the user to log in with more than just Google credentials.  So, this past week, I wrote my “Offline Vue Boilerplate“.  It is meant to be a starting point for the State Parks app and a few other apps that I have kicking around in my head.  I figured that this week, we should go over what I wrote.

    Overview

    The whole point of this “boilerplate” application was for it to be a common starting point for other applications that use Firebase for authentication and a NoSQL database.  It uses:

    I was using a lot of this stack for work projects, also.  It is nice because Firebase is cheap and robust and you don’t need to write any server-side code.  Hosting of the front-end code is “cheap-as-chips”, also.  The Job Tracker is hosted using Firebase Hosting (which is free on the spark plan) and The Boilerplate App is hosted using Render, which is just as free.

    Authentication

    I am most proud of how I handled authentication with this app.  Here is what the Pinia store looks like:

    From your view, you can access {{ user }} to get to the values that came out of the single sign-on (SSO) provider (the user’s name, email address, picture, etc).  For this app, I used Google and Microsoft but Firebase Authentication offers a lot of options beyond those two.

    Adding Google is pretty easy (after all, Firebase is owned by Google) but adding Microsoft was more difficult. To get keys from Microsoft, you need to register your application with the Microsoft identity platform.  Unfortunately, the account that you use for that must be an Azure account with at least a Cloud Application Administrator privileges and it can not be a personal account.  The account must be associated with an Entra tenant.  This means that you need to spin up an Entra tenant to register the application and get the keys.

    The third SSO provider that I was tempted to add was Apple but to do that, you need to enroll in the Apple Developer program, which is not cheap.

    Firebase Cloud Firestore

    I have become a big fan of Firebase Cloud Firestore over the years (at least for situations where a NoSQL database makes sense).  The paradigm that I started playing around with last year involved putting the Firebase CRUD functions in the composable.

    Here is an example <script> block from the Job Tracker:

    The author of the view doesn’t even need to know that Firebase Cloud Firestore is part of the stack.  You might wonder how security is handled.

    Here is what the security rule looks like behind the job tracker:

    The rule is structured so that any authenticated user can create a new record but users can only read, delete, or update if they created the record.

    How I made it into a Progressive Web App (PWA)

    This is the easiest bit of the whole process.  You just need to add vite-plugin-pwa to the dev dependencies and let it build your manifest.  You do need to supply icons for it to use but that’s easy enough.

    The Next Steps

    I am going to be using this as a stepping-stone to build 2-3 apps but you can look forward to a few deep-dive posts on the stack, also.

    Have any questions, comments, etc?  Please feel free to drop a comment, below.

     

    [ Cover photo by Barn Images on Unsplash ]

    https://jws.news/2024/wrote-a-thing-with-vue-and-firebase/

    #CompositionAPI #Firebase #pinia #StateParksApp #VueJs #vuex

  5. This past autumn, I started playing around with the Composition API, and at the October 2023 Hack and Tell, I put that knowledge into writing a “Job Tracker“.  The job tracker used Vuex and Firebase Authentication to log a user in using their Google credentials.  With const store = useStore() on your view, you can do something like Welcome, {{user.data.displayName}} but using this technique you can also use …

    const LoginWithGoogle = async () => {
    try {
    await store.dispatch('loginWithGoogle')
    router.push('/')
    }
    catch (err) {
    error.value = err.message
    }
    }

    … to kick off the authentication of the user.  I want to use it to finally finish the State Parks app but I also want to use Pinia instead of Vuex, I wanted the resulting app to be a PWA, and I wanted to allow the user to log in with more than just Google credentials.  So, this past week, I wrote my “Offline Vue Boilerplate“.  It is meant to be a starting point for the State Parks app and a few other apps that I have kicking around in my head.  I figured that this week, we should go over what I wrote.

    Overview

    The whole point of this “boilerplate” application was for it to be a common starting point for other applications that use Firebase for authentication and a NoSQL database.  It uses:

    I was using a lot of this stack for work projects, also.  It is nice because Firebase is cheap and robust and you don’t need to write any server-side code.  Hosting of the front-end code is “cheap-as-chips”, also.  The Job Tracker is hosted using Firebase Hosting (which is free on the spark plan) and The Boilerplate App is hosted using Render, which is just as free.

    Authentication

    I am most proud of how I handled authentication with this app.  Here is what the Pinia store looks like:

    From your view, you can access {{ user }} to get to the values that came out of the single sign-on (SSO) provider (the user’s name, email address, picture, etc).  For this app, I used Google and Microsoft but Firebase Authentication offers a lot of options beyond those two.

    Adding Google is pretty easy (after all, Firebase is owned by Google) but adding Microsoft was more difficult. To get keys from Microsoft, you need to register your application with the Microsoft identity platform.  Unfortunately, the account that you use for that must be an Azure account with at least a Cloud Application Administrator privileges and it can not be a personal account.  The account must be associated with an Entra tenant.  This means that you need to spin up an Entra tenant to register the application and get the keys.

    The third SSO provider that I was tempted to add was Apple but to do that, you need to enroll in the Apple Developer program, which is not cheap.

    Firebase Cloud Firestore

    I have become a big fan of Firebase Cloud Firestore over the years (at least for situations where a NoSQL database makes sense).  The paradigm that I started playing around with last year involved putting the Firebase CRUD functions in the composable.

    Here is an example <script> block from the Job Tracker:

    The author of the view doesn’t even need to know that Firebase Cloud Firestore is part of the stack.  You might wonder how security is handled.

    Here is what the security rule looks like behind the job tracker:

    The rule is structured so that any authenticated user can create a new record but users can only read, delete, or update if they created the record.

    How I made it into a Progressive Web App (PWA)

    This is the easiest bit of the whole process.  You just need to add vite-plugin-pwa to the dev dependencies and let it build your manifest.  You do need to supply icons for it to use but that’s easy enough.

    The Next Steps

    I am going to be using this as a stepping-stone to build 2-3 apps but you can look forward to a few deep-dive posts on the stack, also.

    Have any questions, comments, etc?  Please feel free to drop a comment, below.

     

    [ Cover photo by Barn Images on Unsplash ]

    https://jws.news/2024/wrote-a-thing-with-vue-and-firebase/

    #CompositionAPI #Firebase #pinia #StateParksApp #VueJs #vuex

  6. I quite like using #Vue 3's script setup style. Very little boilerplate and defining props as TS types is great.

    vuejs.org/api/sfc-script-setup

    pinia.vuejs.org/ is also 👍 I couldn't stomach #Vuex with its string-based actions or whatever.

    #Pinia just makes sense to me. It doesn't try to do very much at all. It just lets me define reactive models and import them into my components.

  7. IMO global stores like in #vuex, #pinia or #redux are just as bad as global variables.

  8. Is it just me who thinks that a #Vuex store is a total mess?! It makes things more complicated than without it. 🤔🤨

  9. It feels a bit messy, to have multiple stores to take care of the url, the filters, and the actual request. But at least it makes kind of sense. First make everything work, then clean up. #vuex

  10. Bei Vue.js handelt es sich um ein Framework zum Entwickeln grafischer Oberflächen für Webanwendungen. Doch was gibt es darüber hinaus über Vue.js zu wissen? Und wie unterscheidet es sich von React?
    Was man über Vue.js wissen sollte
  11. I had high hopes for #vuex: It wraps all state in one single source of truth in #VueJS, therefore potentially turns everything else into dumb, understandable functions.

    Turns out you can write code under this paradigm that's as hard to work with as a decade old Java code base.

  12. Front-End Developer - We are looking for a front-end web developer who brings creative problem solving,... Routenote / Truro, Cornwall routenote.com/blog/routenote-a #Dev front #HTML #CSS #JS #Vue #VueX #VueRouter by @[email protected]