Email Verification in payload CMS

If you’d like to require email verification before a user can successfully log in, you can enable it by passing true or an options object to auth.verify. The following options are available: generateEmailHTML The function that accepts one argument, containing { req, token, user }, allows for overriding the HTML within emails sent to users… Continue reading Email Verification in payload CMS

Implement clear cache functionality with clear button in vue.js

Adding a clear cache button with NetSuite API. When the button is clicked all the cache will be cleared: Template: <template>  <div class=”dropdown float-right” @click.stop=”toggleDropdown”>   <button class=”three-dots”>    ⋮ <!– Unicode character for vertical ellipsis (three dots) –>   </button>   <div v-if=”isDropdownVisible” class=”dropdown-content bg-grey-300″>    <button @click=”clearCache” class=”float-right py-2 text-black”>     Clear… Continue reading Implement clear cache functionality with clear button in vue.js

Split Function in vue.js

Example:                     linked_charges_name from the API response is like “vendbill-1234” and needs to separate “vendbill-” and display the number only. HTML:    <div v-if=”item.transaction_matches.includes(‘JE’)”> <a :href=”getJournalEntryUrl(item)” class=”text-black-500″ target=”_blank” rel=”noopener noreferrer”>   {{ extractAfterDash(item.linked_charges_name) }} </a> </div> Function:   methods: {   extractAfterDash(value) {      … Continue reading Split Function in vue.js

How can you embed two or more components into one in next js?

In Next.js, you can embed two or more components into one by simply importing them into a parent component and then rendering them within the parent’s render method. Here’s an example: Let’s say you have two components: component A and component B. // ComponentA.js import React from ‘react’; const ComponentA = () => {  … Continue reading How can you embed two or more components into one in next js?

What is payload CMS?

Payload CMS is a modern, headless Content Management System (CMS) built with Node.js, React, and TypeScript. Designed to be developer-friendly and flexible, it allows for extensive customization and integrates seamlessly with modern web development workflows. Here are some key features and aspects of Payload CMS: Headless Architecture: As a headless CMS, Payload separates the content… Continue reading What is payload CMS?

How different is React’s ES6 syntax when compared to ES5?

React’s ES6 syntax offers several advantages over ES5, primarily in terms of readability, conciseness, and developer productivity. Here are some key differences: Class Syntax: In ES6, you can use the class keyword to define React components as classes. This provides a more familiar and intuitive way to define components compared to the React.createclass method in… Continue reading How different is React’s ES6 syntax when compared to ES5?

userAgent in nextjs

The userAgent helper extends the Web Request API with additional properties and methods to interact with the user agent object from the request. Middleware.js import { NextResponse, userAgent } from ‘next/server’   export function middleware(request) {   const url = request.nextUrl   const { device } = userAgent(request)   const viewport = device.type === ‘mobile’… Continue reading userAgent in nextjs

How to enable AMP?

To enable AMP, add the following configuration to your page: page/index.js export const config = { amp: true } The amp configuration accepts the following values: true: The page will be AMP-only ‘hybrid’: The page will have two versions, one with AMP and another with HTML To learn more about the amp configuration, read the… Continue reading How to enable AMP?

Exporting a function called getServerSideProps.

When exporting a function called getServerSideProps (Server-Side Rendering) from a page, Next.js will pre-render this page on each request using the data returned by getServerSideProps. This is useful if you want to fetch data that changes often, and have the page update to show the most current data. export async function getServerSideProps() {   //… Continue reading Exporting a function called getServerSideProps.

Exporting a function called getStaticProps.

Exporting a function called getStaticProps will pre-render a page at build time using the props returned from the function: export async function getStaticProps() {   const res = await fetch(‘https://api.github.com/repos/vercel/next.js’)   const repo = await res.json()   return { props: { repo } } }   export default function Page({ repo }) {   return… Continue reading Exporting a function called getStaticProps.