This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use the cors middleware with specific options | |
app.use(cors({ | |
origin: 'https://example.com', // Specify the allowed origin | |
methods: 'GET,HEAD,PUT,PATCH,POST,DELETE', // Specify the allowed methods | |
allowedHeaders: 'Content-Type,Authorization' // Specify the allowed headers | |
})); | |
# Multiple Selected User Can Access | |
const corsOptions = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cors from "cors" | |
app.use((req, res, next) => { | |
res.setHeader("Access-Control-Allow-Origin", "https://example.com"); // Change to your domain | |
res.setHeader("Access-Control-Allow-Headers", "Content-Type, Authorization"); | |
// Handle preflight requests | |
if (req.method === 'OPTIONS') { | |
res.setHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, PATCH"); | |
return res.status(204).end(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import dotenv from "dotenv"; | |
dotenv.config(); | |
const {CORS, CORS1, CORSLOCAL} = process.env; | |
const corsOptions = { | |
origin: [CORS, CORS1, CORSLOCAL], // Specify trusted domains | |
methods: ['GET', 'POST'], // Specify allowed methods | |
allowedHeaders: ['Content-Type', 'Authorization'] // Specify allowed headers | |
}; | |
app.use(cors(corsOptions)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<TableData filteredData = {filteredData} onUpdateInsurance={onUpdateInsurance} onDeleteAllData ={onDeleteAllData} totalItems = {totalItems} /> | |
import React from 'react'; | |
import UpdateMaster from './UpdateMaster'; | |
const InsuranceTable = ({ filteredData, onUpdateInsurance, onDeleteAllData, totalItems }) => { | |
return ( | |
<div className="inline-block min-w-full w-full py-0 relative"> | |
<table className="min-w-full text-center text-sm font-light table border border-black"> | |
<thead className="border-b font-medium bg-slate-300 sticky top-16"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const TextLoader = () => { | |
return ( | |
<div className="flex justify-center items-center bg-gray-100"> | |
<div className="relative flex space-x-1 text-xl font-bold text-gray-800"> | |
{[...'ELEEDOMIMF'].map((char, index) => ( | |
<span | |
key={index} | |
className="animate-bounce bg-gradient-to-r from-stone-900 to-red-600 bg-clip-text text-transparent rounded-full" | |
style={{ animationDelay: `${index * 0.1}s` }} | |
> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
startTransition: | |
1. startTransition is a function in React that is used when you're about to update a particular state and its impact shouldn't heavily affect the UI. | |
2. Its primary purpose is to ensure that if you're running a long-running process, the user doesn't face significant delays in the UI. | |
3. It allows React to defer the update, making it non-blocking for the user interface. | |
Suspense: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState, useEffect } from "react"; | |
import axios from 'axios'; | |
//COMPONENT TEXTLOADER AND TWUPDATESLAB | |
import TextLoader from "../../loader/TextLoader.jsx"; | |
import TwUpdateSlab from "../UpdatePaySlabs/TwUpdateSlab.jsx"; | |
import { toast } from "react-toastify"; | |
// BACKEND API CALL | |
import VITE_DATA from "../../config/config.jsx"; | |
function TwLists() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from 'react'; | |
// List component | |
const ListWithUpdate = () => { | |
const [APIData, setAPIData] = useState([]); | |
// STATE TO MANAGE POPUP AND DATA | |
const [showUpdatePopup, setShowUpdatePopup] = useState(false); | |
const [selectedItem, setSelectedItem] = useState(null); | |
// SEND DATA WITH ID AND POPUP TRUE TO OPEN | |
const handleUpdateClick = (id) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from 'react'; | |
function AddTerminator() { | |
const [terminatedate, setTerminateDate] = useState(""); | |
const [dateInput, setDateInput] = useState(""); | |
const convertDateFormat = (dateStr) => { | |
const [year, month, day] = dateStr.split('-'); | |
return `${day}-${month}-${year}`; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState } from 'react'; | |
const App = () => { | |
const [albums, setAlbums] = useState([ | |
{ userId: 1, title: 'Album', id: 1 }, | |
{ userId: 1, title: 'omnis laborum odio', id: 2 }, | |
{ userId: 1, title: 'omnis laborum odio 2', id: 3 }, | |
{ userId: 2, title: 'aque aut omnis a', id: 4 }, | |
{ userId: 2, title: 'aque aut omnis a laborum odio', id: 5 }, | |
{ userId: 3, title: 'omnis laque aut omnis', id: 6 }, | |
]); |
OlderNewer