Skip to main content


Showing posts with the label Vue

Vue 3 Consume GraphQL Endpoint Using Vue Apollo

In this article, we are going to implement Vue 3 sample application that consumes GrpahQL Endpoint using the Vue Apollo library. Create Vue 3 Application: Let's create a sample Vue 3 application to accomplish our demo. Vue CLI Command To Create Project: vue create your_project_name GraphQL Server Endpoint: We should have a GraphQL server endpoint for our demo. So I created a GraphQL server endpoint using 'Dotnet', so I'm going to use it here so its URL be like 'https://localhost:6001/graphql'. So please make sure to have your own GraphQL server endpoint. Install Vue Apollo And Its Dependent Libraries: npm install --save @vue/apollo-option npm install --save @apollo/client npm install --save graphql npm install --save graphql-tag One more plugin we have to install 'react', at the time of this article written we will get an error that says that need to install the 'react', so this 'react' installation might be avoided in feature r

Part-2 VueJS JWT Auth Cookie - Refresh Token Usage

Part-1  we implemented user login and logout using the HttpOnly Jwt cookie in our Vue application. In this article, we are going to understand the refresh token(refresh token also stored in HttpOnly Jwt Cookie). Gaurd Routes: One of the important cases we always need to consider while implementing authentication is guard routes between user authenticated and non authenticates cases. Suppose an authenticated user can't access the login page. Similarly, a non-authenticated user can't access the dashboard page(any page that needs user authentication). So to fix this kind of case we have to define our navigation rules at our route guard. But before implementing our route guard logic, we need to set one flag in browser local storage. The flag we will add represents that the user is authenticated. This flag helps us to avoid unnecessary calls to the profile API if the user reloads the application. Now let's add the flag to browser local storage on user authenticated. So let&#

Part-1 VueJS JWT Auth Cookie - Access Token Usage

In this article, we will implement Vue3 application authentication with the JWT auth cookie. So in this portion, we mainly target access token utilization. To know about Jwt authentication in vuejs like managing token using browser storage then check below mentioned articles. Part-1 Jwt Access Token Auth In Vue3 Part2 Refresh Token In Vue3 HTTP Only JWT Cookie: The HTTP only cookie is only accessible by the server application. Client apps like javascript-based apps can't access the HTTP-only cookie. So if we use authentication with HTTP only JWT cookie then we no need to implement custom logic like adding authorization header or storing token data, etc at our client application. Because once the user authenticated, that auth cookie will be automatically sent to the server by the browser on every API call. Authentication API: To implement JWT cookie authentication we need to set up an API. For that, I had created a mock authentication API(Using the NestJS Server framework). So d

Pagination In Vue3 Application Using '@ocrv/vue-tailwind-pagination' Plugin

In this article, we will understand the pagination in the Vue3 application using the '@ocrv/vue-tailwind-pagination' plugin. Key Features Of Plugin: current -  The 'current' property to set the current page number. total - The 'total' property that represents the number of records for the table content. So based on this 'total' property value, the total number of page numbers display depends. per-page - The 'per-page' property to set the count for the records to display for each page. page-changed - The 'page-changed' event that raises on selecting the page. It outputs  '$event' which is nothing but the selected page number. Create A Vue3 Sample Application: To implement our pagination sample let's begin by creating a Vue3 sample application. Command To Create Vue3 Application: Vue Create Your_Sample_App_name Install Tailwind Pagination NPM Package: Tailwind Pagination NPM Package Command: npm install --save @ocrv/vue-ta

360 Degree Image Preview In VueJS Application Using 'vue-360' Plugin

This article, explains about 360-degree image previewer in the vue.js application using the 'vue-360' plugin. Overview  On 'vue-360' Library: Some of the key features of the 'vue-360' library are: amount - total number of image count that is used to display the 360-degree image preview. imagePath -   need to specify the relative path or full domain path without the image name. fileName - need to specify the file name. spinReverse - boolean property used to rotate the images in reverse order. The default value is false. autoplay -  autoplay your images. The default value is '24' images. loop - number of loops you want for autoplay. The default value is '1'. boxShadow-  apply a box-shadow background. The default value is 'false'. buttonClass - apply styling to buttons. The default value is 'light'. paddingIndex - apply leading zero to image index. The default value is 'false'. disableZoom - disabling zoom functionality.

Ionic&Vue Application Integrate Side Menu With ion-menu Component

In this article, we are going to learn about the steps to integrate the side menu using the 'ion-menu' component in the Ionic&Vue application. 'ion-menu' Component: Using the 'ion-menu' component we can develop a verticle side menu for our mobile ionic application. The menu should be rendered as a sibling element to the root content element. Mostly the root content element in our Ionic&Vue application is 'ion-router-outlet', so our menu element should be the sibling to it. So to operate on the menu component we have to use the 'menucontroller' that loads from the '@ionic/vue'. The key terms we need to remember while implementing the 'ion-menu' component: menucontroller: The 'menucontroller' helps to operate on our menu like opening and closing of the menu. It's not ideal to use multiple menus in the application but ionic supports to render multiple menus so to open them from anywhere of entire application it is