window.print() duplicating pages on JS

I’m using a function to print a Modal, and it’s returning with a duplicate.

The Function:

function printElement(btnVal)
{
// $(‘.abrirLogs’).trigger( “click” );

// REMOVE OS ELEMENTOS DESNECESSÁRIOS
  $('html').find('.remove_on_print').remove();

// VERIFICA QUAL A DESPESA QUE ESTÁ SENDO VISUALIZADA
  $('html').find('.despCard').each(function (i, val) {
    if ($(this).css('display') == 'none') {
      $(this).remove();
    }
  });

document.title = `Relatório do Pedido de Despesa # ${$('#pedidoIdentif').val()} - Despesa ${$('.despCount'+btnVal).val()}`;

parent.$('title').get(0).innerHTML = 'relatorio_pedido_despesa' + $('#despID').val();

console.log(window);

window.print();

parent.$('title').get(0).innerHTML = 'Pedidos Aprovados';

location.reload();

return true;

};

[The print popup images:](https://i.stack.imgur.com/xHdVq.png)

I’ve look for the same problem but couldn´t find the answer.

Turn an Electron app into a mobile app using Capacitor?

I have an electron app that uses the ipcrenderer quite liberally and don’t see any easy way to convert it to a mobile app, specifically iOS outside completely rewriting it using something like Vue Native or React Native. I found something called Capacitor though that seems to be the magic solution, but I don’t see a simple way to just package my electron app into capacitor.

Is there a simple solution I’m missing to do this, is there a guide out there already showing how to do this conversion, or is there another framework out there to do this that won’t require starting from scratch?

what is zod equivalent for yup’s setLocale?

I want to set default custom error messages for zod validation

in yup if I want to have error messages that use i18n I do:

import { t } from "i18next";
import * as yup from "yup";
import "./i18next";

yup.setLocale({
  mixed: {
    required: () => t("validation:required"),
  },
  string: {
    min: ({ min }) => t("validation:minStr", { value: min }),
    max: ({ max }) => t("validation:maxStr", { value: max }),
  },
  array: {
    min: ({ min }) => t("validation:minArr", { value: min }),
    max: ({ max }) => t("validation:maxArr", { value: max }),
  },
});
export default yup;

how is this possible in zod?

How do i keep a 2 columns and a piechart the same height when changing the size of a window

Im working on a project and hit a roadblock where i have two columns, one of them has a pie chart inside and im having issues keeping two columns the same size when adjusting the window size. when i get the 2 columns to stay the same size the pie chart decides to bug out, how can i keep both columns the same also having the pie chart to adjust correctly without bugging out.

by bugging out i mean the pie chart overlaps off the column.

enter image description here

enter image description here

ive spent hours trying to find a solution, i tried fixing height of both columns (which works until the screen becomes small causing the columns to overlap) and tweaking the size of the pie chart to force the column to match the other one but nothing, im basically stumped.

Heres the html and css of the project:

  <div class="container-fluid top-info">
            <div class="row top-info">
                <!--Nutrition value-->
                <div class="col-sm-6">
                    <div class="nutrition">
                        <!--Nutritional value title-->
                        <div class="row nutrition-values">
                            <div class="col-sm">
                                <h2>Nutritional Values</h2>
                            </div>
                        </div>
                        <!--input box for grams-->
                        <div class="row grams-input">
                            <form>
                                <div class="form-group grams-row">
                                    <input type="text" name="grams" id="inputg" size="5">
                                    <label for="grams">g</label>
                                </div>
                            </form>
                        </div>
                        <ul>
                            <li class="servingsize">Serving Size per 100/Grams <span class="float-end"></span></li>
                            <li>Carbohydrates: <span class="float-end">5</span></li>
                            <li>Cholesterol: <span class="float-end">56</span></li>
                            <li>Saturated fat: <span class="float-end">5</span></li>
                            <li>Total Fat: <span class="float-end">5</span></li>
                            <li>Fiber Content: <span class="float-end">5</span></li>
                            <li>Potassium <span class="float-end">5</span></li>
                            <li>Protein: <span class="float-end">5</span></li>
                            <li>Sodium:<span class="float-end">5</span></li>
                            <li>Sugar: <span class="float-end">0.6</span></li>
                        </ul>
                    </div>
                </div>
                <!--Graph-->
                <div class="col-sm-6">
                    <div class="container-fluid graph">
                    <!--calories information heading-->
                        <div class="cal-heading">
                            <h5>100/Grams of Granola Has a total of <span>400 Calories</span></h5>
                        </div>    
                        <!--pie chart graph--> 
                        <canvas id="myChart"></canvas>
                    </div>
                </div>
            </div>
        </div>
<script>
            new Chart(document.getElementById('myChart'), {
              type: 'pie',
              data: {
                labels: ["HTML", "CSS", "JavaScript", "PHP", "MySql"],
                datasets: [{
                  backgroundColor: ["#e63946", "#254BDD",
                    "#ffbe0b", "#1d3557", "#326998"
                  ],
                  data: [418, 263, 434, 586, 332]
                }]
              },
              options: {
                title: {
                  display: false,
                  text: 'Pie Chart for admin panel'
                },
                responsive: true
              }
            });
          </script>
.logo{
    text-align: center;
    padding-top: 35px;
}

#search{
    justify-content: center;
    padding-top: 35px;
    padding-bottom: 150px;
    width: 70%;
    margin: auto;
}

.inputstyle {
    padding: 20px !important;
}

#button {
  background-color: #494747;
  color: white;
  width: 8em;
  font-size: 30px !important;
  border-style: solid;
  border-color: rgb(255, 255, 255);
  border-width: 1px;
  font-weight: 300;
  font-size: 20px;
  line-height: 24px;
}

.top-info{
    padding-left: 40px;
    padding-right: 40px;
}

.nutrition{

    background: #FFFFFF;
    box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);
    border-radius: 23px;

}

.graph{
    background: #FFFFFF;
    box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);
    border-radius: 23px;
    text-align: center;
    }

.nutrition-values{
    padding-top: 20px;
}

.grams-input{
    padding-bottom: 15px;
}

h2{
    margin-left: 42px;
}

ul {
    padding-bottom: 20px;
}

ul li {
    list-style: none;
    margin-bottom: 20px;
    margin-left: 10px;
    border-bottom: 1px solid #efefef;
    width: 90%;
}

.servingsize {
    background-color: #000000;
    padding: 10px;
    color: #ffffff;
}

#inputg{
    padding: 10px;
    border: 2px solid;
    border-radius: 0px;
    font-size: 16px;
    margin-left: 42px;
    height: 40px;
}

label{
    font-size: 20px;
    font-weight: 500;
}

.cal-heading{
    padding-top: 20px;
}

span{
    color: #4B8673;
}

How to query Azure log analytics using javascript SDK?

The bottom code is what I am using to query log analytics. All I am getting are results with the column names only, but no actual data. I have already logged in to my azure using the CLI. Have set up the right workspace ID as well. Do I have to enable anything else? The same query runs properly when I run it directly in the azure portal of log analytics. My end goal is to query logs of a kubernet service running.

import { Durations, LogsQueryClient, LogsQueryResultStatus, LogsTable } from "@azure/monitor-query";

const azureLogAnalyticsWorkspaceId = "xxx";
const logsQueryClient = new LogsQueryClient(new DefaultAzureCredential());

export const queryLogAnalytics = async () => {
    const kustoQuery = `KubePodInventory`;
    const result = await logsQueryClient.queryWorkspace(azureLogAnalyticsWorkspaceId, kustoQuery, {
        duration: Durations.twentyFourHours,
    });

    console.log(result);


    if (result.status === LogsQueryResultStatus.Success) {
        const tablesFromResult: LogsTable[] = result.tables;

        if (tablesFromResult.length === 0) {
            console.log(`No results for query '${kustoQuery}'`);
            return;
        }
        console.log(`This query has returned table(s) - `);
        processTables(tablesFromResult);
    } else {
        console.log(`Error processing the query '${kustoQuery}' - ${result.partialError}`);
        if (result.partialTables.length > 0) {
            console.log(`This query has also returned partial data in the following table(s) - `);
            processTables(result.partialTables);
        }
    }
}

This is the result I get when I run the code.

{
  tables: [
    {
      name: 'PrimaryResult',
      columns: [Array],
      rows: [],
      columnDescriptors: [Array]
    }
  ],
  statistics: undefined,
  visualization: undefined,
  status: 'Success'
}
This query has returned table(s) -
| TenantId(string) | SourceSystem(string) | TimeGenerated(datetime) | Computer(string) | ClusterId(string) | ContainerCreationTimeStamp(datetime) | PodUid(string) | PodCreationTimeStamp(datetime) | InstanceName(string) | ContainerRestartCount(int) | PodRestartCount(int) | PodStartTime(datetime) | ContainerStartTime(datetime) | ServiceName(string) | ControllerKind(string) | ControllerName(string) | ContainerStatus(string) | ContainerID(string) | ContainerName(string) | Name(string) | PodLabel(string) | Namespace(string) | PodStatus(string) | ClusterName(string) | PodIp(string) | ContainerStatusReason(string) | ContainerLastStatus(string) | Type(string) | _ResourceId(string)  

GraphQL: Problem with case convertion in queries/mutations

I am using Postgres for my database, Knex to build the database, Graphql to run queries and mutations and Vue.js in front-end.

The problem is, i need to show the values from the table(s) in the front-end, but i am having problems with case conversion, my DB uses snake_case, but the API uses camelCase.

cotacoesLoad: async (_root, _args, ctx, _info) => {
    return ctx.database('cotacoes')
  },

i’m also using a field resolver to bring data from a related table:

cliente: async (root, _args, ctx, _info) => {
    return ctx.database('erp_clientes').where({ id: root.cliente_id }).first()
  }

this is how I typed the table and the query in graphql:

type Cotacao {
  id: String!
  cliente: ErpCliente!
  situacao: Int
  localEntrega: Int
  amostraInicial: String
  lotePiloto: String
  producao: String
  ferramental: String
  dataEnvio: LocalDate
  nrCotacaoCliente: Int
}

extend type Query {
  cotacoesLoad: [Cotacao!]!
}

the result of the query in playground:

{
  "data": {
    "cotacoesLoad": [
      {
        "cliente": {
          "nome": "mestre"
        },

        "situacao": 1,
        "localEntrega": null,
        "amostraInicial": null,
        "lotePiloto": null,
        "producao": "produ",
        "ferramental": "a",
        "dataEnvio": null,
        "nrCotacaoCliente": null
      }
    ]
  }
}

the issue is: fields that are represented with more than 1 word (example: localEntrega) are returning null, probally because there is no case convertion and the DB will only recognize single-word fields.

I can’t use snake case in my API, so i ask, what would be the best way to convert those camelCased fields to snake_case fields?

i’ve tried to just write the fields in snake_case but I know this isn’t the right way to do.

other thing i’ve done was a file to rename all these camelCased fields to snake_case in a ‘fields’ file like this:

localEntrega: root => {
    return root.local_entrega
  }

but it was not accepted because its also a bad way to do it.

Selecting a specific row based on value – Javascript- Google Sheets

Complete beginner here, please bear with my question. I followed this tutorial for referencing my google sheets in my web https://www.youtube.com/watch?v=vtq2xTWK7h4 .

    <script>
      let SHEET_ID = '(spreadsheet ID)'
      let SHEET_TITLE = "Sheet1"
      let SHEET_RANGE = 'A1:G1000'

      let FULL_URL = ('https://docs.google.com/spreadsheets/d/' + SHEET_ID + '/gviz/tq?sheet=' + SHEET_TITLE + '&range=' + SHEET_RANGE);

      fetch(FULL_URL)
      .then(res => res.text())
      .then(rep => {
        let data = JSON.parse(rep.substr(47).slice(0,-2));

        let Ticket_Number = document.getElementById('Ticket_Number');
        let Ticket_Name = document.getElementById('Ticket_Name');
        let Ticket_Date = document.getElementById('Ticket_Date');
        let Ticket_Timeslot = document.getElementById('Ticket_Timeslot');
        
        console.log(data.table.rows[5])
      })      
    </script>

Through “console.log(data.table.rows[5])”, changing the [5] to any number allows me to refer to different rows within my google spreadsheet (eg: 0 = row 1, 1 = row 2, and so on).

Is there a way I could reference a specific row based on a value contained in that row?

For example, i want to select row 7 through something like, if row contains “2010202305000006”, select that row.

enter image description here

I plan to then get values from this row.

I tried experimenting around with includes(),

console.log(data.table.rows.includes("2010202305000006")

but the console would only display “false”. Or maybe is there maybe a better way to maybe link my spreadsheet?

Any help would be appreciated, thank you in Advance!

im trying to store likes in localstorage but its not working for me

As explained, I am using localstorage to save my cart as well as previously liked photos. It works fine for cart items but it is not saving updates to the ‘liked’ photos. What am i doing wrong here?

I have tried a number of things including splitting out the useffects and managing the dependancy array for them but to no avail. When i check the application tag it is successfully updating the isfavorite value for the individual photo but once refreshing it goes back to the default.

import React,{ useState,useEffect } from "react";
const Context = React.createContext()

function ContextProvider(props){
    const [allPhotos, setAllPhotos] = useState([])
    const [cartItems, setCartItems] = useState([])
    const url = "https://raw.githubusercontent.com/bobziroll/scrimba-react-bootcamp-images/master/images.json"
    useEffect(() => {
      fetch(url)
      .then(res=>res.json())
      .then(data => setAllPhotos(data))
    }, [])


    const toggleFavorites = (id) =>{
        const updatedArray = allPhotos.map(photo=> {
            if (photo.id === id){
                return {...photo, isFavorite: !photo.isFavorite}
            } return photo
        })
        setAllPhotos(updatedArray)
    }

    const addItem = (newItem) => {
        setCartItems(prevItems=>([...prevItems,newItem]))
    }

    const removeItem = (id) => {
        setCartItems(prevItems=>(prevItems.filter(item=>item.id !== id)))
    }

    function emptyCart(){
        setCartItems([])
    }

    useEffect(()=> {
        const cartData = window.localStorage.getItem("CART_SETTINGS")
        if (cartData !== null) setCartItems(JSON.parse(cartData))
    },[])

    useEffect(()=> {
        const photoData = window.localStorage.getItem("PHOTO_SETTINGS")
        if (photoData !== null) setAllPhotos(JSON.parse(photoData))
    },[])


    useEffect(()=> {
        window.localStorage.setItem(`PHOTO_SETTINGS`, JSON.stringify(allPhotos))
        window.localStorage.setItem(`CART_SETTINGS`, JSON.stringify(cartItems))
    },[allPhotos, cartItems])

    
    return (
        <Context.Provider value={{
            allPhotos, 
        toggleFavorites,
        cartItems, 
        addItem,
        removeItem, 
        emptyCart}}>
            {props.children}
        </Context.Provider>
    )
}

export {ContextProvider, Context}

How to build vueJs3 Project (using vite), Error : [rollup-plugin-dynamic-import-variables] Unexpected token

I have vuejs3 project using vite, when I run npm run build I have this errors :

1-

[vite]: Rollup failed to resolve import "src/assets/img/users/patient.png" from 
"src/views/patientViews/profile.vue".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`

2-

[rollup-plugin-dynamic-import-variables] Unexpected token (10:2)
file: D:/PFE/Fontend/HealthAppFront-main/src/assets/js/ipfs.js:10:2
error during build:
SyntaxError: Unexpected token (10:2)
  at Parser.pp$4.raise (D:PFEFontendHealthAppFront-mainnode_modulesrollupdistsharedrollup.js:19728:13)
  at Parser.pp$9.unexpected (D:PFEFontendHealthAppFront-mainnode_modulesrollupdistsharedrollup.js:17022:8)
  at Parser.pp$5.parseExprAtom (D:PFEFontendHealthAppFront-mainnode_modulesrollupdistsharedrollup.js:19103:10)

vite.config.js : config

click opening menu is not working properly

Im trying to recreate apple website.

This is the HTML code

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" href="styles/style.css">
        <link rel="stylesheet" href="styles/menu.css">
        <link rel="stylesheet" href="styles/header.css">
        <link rel="stylesheet" href="styles/page.css">




        <title>Apple</title>
    </head>
    <body>
        <header id="header">
            <div class="headerContent">
                <a class= "menuBtn"> 
                    <ion-icon name="menu-outline" class="logoImg"> </ion-icon>
                </a>
                <a href=""> 
                    <ion-icon name="logo-apple" class="logoImg"> </ion-icon>
                </a>
                <a href=""> 
                    <ion-icon name="bag-outline" class="logoImg"> </ion-icon>
                </a>

            </div>
        </header>

        <div class="menu">
            <div class="menuContent">
                <div class="menuInput">
                    <input type="text" placeholder="Search apple.com">
                </div>
                
                <div class="menuItem">
                    <a href="">Store</a>

                </div>
                
                <div class="menuItem">
                    <a href="">Mac</a>

                </div>
                <div class="menuItem">
                    <a href="">iPad</a>

                </div>
                
                <div class="menuItem">
                    <a href="">iPhone</a>
                    
                </div>
                
                <div class="menuItem">
                    <a href="">Watch</a>
                    
                </div>
                
                <div class="menuItem">
                    <a href="">Airpods</a>
                    
                </div>
                
                <div class="menuItem">
                    <a href="">Tv & Home</a>
                    
                </div>
                
                <div class="menuItem">
                    <a href="">Entertainment</a>
                    
                </div>
                
                <div class="menuItem">
                    <a href="">Accessories</a>
                    
                </div>
                
                <div class="menuItem">
                    <a href="">Support</a>
                    
                </div>


            </div>

        </div>

        <div class="list">
            <div class="listItem">
                <img src="image/list/macBookAir.PNG" alt="">
            </div>
            <div class="listItem">
                <img src="image/list/macBookPro.PNG" alt="">
            </div>
            <div class="listItem">
                <img src="image/list/iMac.PNG" alt="">
            </div>
            <div class="listItem">
                <img src="image/list/macMini.PNG" alt="">
            </div>
            <div class="listItem">
                <img src="image/list/macStudio.PNG" alt="">
            </div>
            <div class="listItem">
                <img src="image/list/macPro.PNG" alt="">
            </div>
            <div class="listItem">
                <img src="image/list/compare.PNG" alt="">
            </div>
          
        </div>

        <script type="module" src="https://unpkg.com/[email protected]/dist/ionicons/ionicons.esm.js"></script>
        <script nomodule src="https://unpkg.com/[email protected]/dist/ionicons/ionicons.js"></script>
        
    </body>
</html>

**This is the js code **

const menuBtn = document.querySelector('.menuBtn');
const menu = document.querySelector('.menu');
const header = document.querySelector('#header');

let IsMenuOpen = false;

menuBtn.addEventListener('click', () => {
    if(IsMenuOpen === false) {
        slideDown();
        header.backgroundColor = "black";
        IsMenuOpen = true;
    }else {
        slideUp();
        header.backgroundColor = "#333333";
        IsMenuOpen = false;
    }
})

function slideUp() {
    menu.style.transition = "all 0.5s ease-in-out";
    menu.style.height = "0px";

}
slideUp();

function slideDown() {
    menu.style.transition = "all 0.5s ease-in-out";
    menu.style.height = "100%";
    
}

then there are 4 difference css codes

By clicking a button on the left I should open a menu, but it doesn’t work: the menu is always opened even if I don’t click.
If I click it remains the same, i think the js code is correct, because i dontfind any error

{“error”: {“error”: “TypeError: Network request failed”, “status”: “FETCH_ERROR”}}

I am developing a React-Native application for iOS where the user can transfer money from person to another by scanning a QR code (this holds the payment destination) via Stripe. After I scan the QR Code I get this error ‘{“error”: {“error”: “TypeError: Network request failed”, “status”: “FETCH_ERROR”}}’ in the terminal. What is supposed to happen is the payment sheet appears with the value to be paid which is calculated on the previous screen. Stripe is the service I’m using to handle the payments. I am able to make a post request through the terminal and it shows up on my dashboard on the Stripe website and I receive a response.

I have all of the code for scanning the QR code and displaying the payment sheet in one file.

QRCodeScan.js

import { View,StyleSheet, Text, Button, Alert } from 'react-native'
import React, { useState, useEffect } from 'react'
import { BarCodeScanner } from 'expo-barcode-scanner'
import { useNavigation } from '@react-navigation/native'
import { useCreatePaymentIntentMutation } from '../../store/apiSlice'
import { useRoute } from '@react-navigation/native'
import {useStripe} from '@stripe/stripe-react-native'
const QRCodeScan = () => {
  //This screen is used to scan QR codes and then display the Stripe payment functionality

  const[hasPermission, setHasPermission] = useState('')
  const[scanned, setScanned] = useState(false)
  const[iban, setIban] = useState('Scan a QR Code')
  const [createPaymentIntent] = useCreatePaymentIntentMutation()
  const{initPaymentSheet, presentPaymentSheet} =  useStripe()
  const navi = useNavigation()
  const route = useRoute()

  const Tip = route.params.calculatedTip

  //Asks the device for permission to use the camera and sets it to granted if allowed
  const askForCameraPermission = () =>{
    (async () =>{
      const {status} = await BarCodeScanner.requestPermissionsAsync()
      setHasPermission(status === 'granted')
    })()
  }
  //The display box for the permission request
  useEffect(() =>{
    askForCameraPermission()
  }, [])

  //Scans and stores the information scanned from the barcode and then loads the Stripe payment overlay
  const handleBarCodeScanned = ({type, data}) =>{
    setScanned(true)
    setIban(data)
    console.log("Type: " + type)
    console.log("Data: " + data)
    onMakePayment()
  }

  //Sets the total from the calculated Tip
  const onMakePayment = async () => {
    const response = await createPaymentIntent({amount: route.params.Tip })
    
    console.log(response)

    if(response.error){
      Alert.alert('Something went wrong,', response.error)
      return;
    }

    const { paymentIntent } = response.data;

    //Sets the payment details and sets the employees IBAN as the destination of the payment
  const paymentMethod = {
    type: 'sepa_debit',
    sepa_debit: {
      iban: iban, // set the IBAN to the scanned value
    },
    billing_details: {
      name: '***', // set the name for the billing details
    },
  };

  const { error } = await stripe.createPaymentMethod(paymentMethod);

  if (error) {
    Alert.alert('Something went wrong,', error.message);
    return;
  }

    const initResponse = await initPaymentSheet({
      merchantDisplayName: 'Tipper',
      paymentIntentClientSecret: paymentIntent.client_secret,
      customFlow: true,
      paymentMethodId: paymentMethod.id
      
    })

    if(initResponse.error){
      console.log(initResponse.error)
      Alert.alert('Something went wrong,', response.error)
      return;
    }
    
    await presentPaymentSheet()

  };




  
  //If hasnt been granted or denied, device requests user to either grant or deny permission
  if(hasPermission === null) {
    return(
      <View style={styles.container}>
      <Text>Requesting camera permission</Text>
      </View>
    )
  }
  
  //If permission isnt granted, camera isnt used and displays no access to camera
  if(hasPermission === false){
    return(
      <View style={styles.container}>
      <Text style={{margin: 10}}>No access to camera</Text>
      <Button title={'Allow camera'} onPress={() => askForCameraPermission()}></Button>
      </View>
    )
  }
  return(
    <View style={styles.container}>
    <View >
    <BarCodeScanner 
      onBarCodeScanned={scanned ? undefined : handleBarCodeScanned}
      style={{height: 400, width: 400}}>
      </BarCodeScanner>
    </View>
    <Text style={styles.maintext}>{iban}</Text>
    {scanned && <Button title={'Scan again'} onPress={() => setScanned(false)} color='tomato'></Button>}
    </View>
    )
  }
  
  const styles = StyleSheet.create({
    root:{
        alignItems: 'center',
        padding: 25
    },
    title:{
      fontSize: 20,
      fontWeight: 'bold',
      margin: 10
    },
    container: {
        backgroundColor: 'white',
        width: '100%',
        borderColor: '#E8E8E8',
        borderWidth: 1,
        borderRadius: 5,
        paddingHorizontal: 10,
        paddingVertical: 10,
        marginVertical: 7
    },
    value:{
        fontSize: 20,
        fontWeight: 'bold',
        margin: 10
    },
    barcodebox:{
      alignItems: 'center',
      justifyContent: 'center',
      height: 300,
      width: 300,
      overflow: 'hidden',
      borderRadius: 30,
      backgroundColor: 'tomato'
    },
    maintext:{
      fontSize: 16,
      margin: 20
    }
})


export default QRCodeScan

server.js

const express = require('express')
const paymentRoutes = require('./PaymentLogic/PaymentRoute')
const bodyParser = require('body-parser')
const app = express()
const PORT = 3000

app.use(bodyParser.json())
app.use('/payments', paymentRoutes)


app.listen(PORT, () =>{
    console.log('API listening on port ', PORT)
})

PaymentRoute.js
this file connects my app to Stripe with the secret key

const express = require('express')
const router = express.Router()
const stripe = require('stripe')(Took key out for security for this post )

//This is used to post the transaction details to Stripe account for Tipper
router.post('/intents', async(req, res) =>{
    try {
        const paymentIntent = await stripe.paymentIntents.create({
        amount: req.body.amount,
        currency: 'eur',
        automatic_payment_methods:{
           enabled: true 
        }
    })

    res.json({paymentIntent: paymentIntent.client_secret})
    } catch (error) {
        res.status(400).json({
            error: error.message
        })
    }
    
})

module.exports = router

apiSlice.js

//This file is used to create the payments that would be sent to Stripe
import {createApi, fetchBaseQuery} from '@reduxjs/toolkit/query/react'

const baseUrl = 'http://localhost:3000/';

export const apiSlice = createApi({
  reducerPath: 'api',
  baseQuery: fetchBaseQuery({ baseUrl }),
  endpoints: (builder) => ({
    // Payments
    createPaymentIntent: builder.mutation({
      query: (data) => ({
        url: 'payments/intents',
        method: 'POST',
        body: data,
      }),
    }),
  }),
});

export const {
 useCreatePaymentIntentMutation
} = apiSlice;

index.js for apiSlice.js

import { configureStore } from '@reduxjs/toolkit';
import { apiSlice } from './apiSlice';
 
export const store = configureStore({
  reducer: {

    api: apiSlice.reducer,
  },
  // Adding the api middleware enables caching, invalidation, polling,
  // and other useful features of `rtk-query`.
  middleware: (getDefaultMiddleware) =>
    getDefaultMiddleware().concat(apiSlice.middleware),
})

And this is just a screenshot of the error after the QR code is scanned.
enter image description here

Uncaught TypeError: axios__WEBPACK_IMPORTED_MODULE_1__.default.get(…).then(…).error is not a function

I am trying to build a project in vue 3 for frontend and spring boot in backend. I am using axios to send request but whenever I call axios.get this error pops up but the api call is till being made and the backend function is performing well.But this error is haunting me, I am confused how to solve it. Please help!!
error from console
enter image description here

<template>
  <div class="text-center"><h1 class="text-bg-dark">User Registration</h1></div>
  <div>
    <form class="form-control text-center" @submit.prevent="register">
      <label for="userEmail">Enter your email:</label><br />
      <input
        type="email"
        name="userEmail"
        id="userEmail"
        class="border-3"
        v-model.lazy="dt.userEmail"
      /><br />
      <label for="userPassword">Enter your password:</label><br />
      <input
        type="password"
        name="userPassword"
        id="userPassword"
        v-model.lazy="dt.userPassword"
      /><br />
      <label for="confirmPassword">Enter your password again:</label><br />
      <input
        type="password"
        name="confirmPassword"
        id="confirmPassword"
        v-model.lazy="dt.confirmPassword"
      /><br />
      <label for="userNumber">Enter Contact Number</label><br />
      <input type="number" id="userNumber" v-model.lazy="dt.userNumber" /><br />
      <label for="userAddress">Enter your Address</label><br />
      <input
        type="text"
        id="userAddress"
        v-model.lazy="dt.userAddress"
      /><br />
      <label for="userCity">Pincode</label><br />
      <input type="number" id="userCity" v-model.lazy="dt.userCity" /><br />
      <br />
      <button type="submit">Submit</button>
    </form>
  </div>


  <div>
    <otpVerify v-if="registered" :email="dt?.userEmail" @back="back" />
  </div>
</template>

<script>
import axios from "axios"
import otpVerify from '../components/otpVerify.vue'
export default {
  components:{
    otpVerify
  },
  data() {
    return {
      registered: false,
      dt: {
        userEmail: "",
        userPassword: "",
        confirmPassword: "",
        userNumber: "",
        userAddress: "",
        userCity: "",
      },
    };
  },
  methods: {
    back(){
      this.registered=false;
    },
    register() {
      if (
        this.dt.userEmail == "" ||
        this.dt.userPassword == "" ||
        this.dt.confirmPassword == "" ||
        this.dt.userNumber == "" ||
        this.dt.userAddress == "" ||
        this.dt.userCity == ""
      ) {
        alert("Please fill all the fields");
      } else {
        if (this.dt.userPassword == this.dt.confirmPassword) {
          axios.get(`http://localhost:6969/sendmail/${this.dt.userEmail}`)
          .then((response)=>console.log(response))
          .error((error)=>console.log(error));
          this.registered= !this.registered;
        } else {
          alert("Passwords do not match");
        }
      }
    },
  },
};
</script>

<style></style>

I tried to turn off cosr from crome extension

Adding value to drop-down at first place using javascript

I have the list as shown below and i am trying to loop through the list and get the values using the line data.list[i].SubType

if (data.List && data.List.length > 0) {
    data.List.forEach(function(item) {
//Here i need to add select all to the list on the top for example we have 2 records with pre school in list for those two on top i need to add select all

//Similarly i have one record with KG need to select all for KG as well
 Students.loadDataViaReader(data.List);
}
}

Tried using concat but it’s not working

The file is in the program because: Root file specified for compilation

everytime I try to compile my code I keep getting this error, although the casing and spelling is correct.

File name ‘c:/Users/liver/Desktop/Codecademy/React, Part I/Create a Playlist App With the Spotify API (Part One) – Project/create-react-app/Jamming/src/Components/Playlist/Playlist.js’ differs from already included file name ‘c:/Users/liver/Desktop/Codecademy/React, Part I/Create a Playlist App With the Spotify API (Part One) – Project/create-react-app/Jamming/src/Components/PlayList/Playlist.js’ only in casing.
The file is in the program because:
Root file specified for compilation
Imported via ‘../Playlist/Playlist’ from file ‘c:/Users/liver/Desktop/Codecademy/React, Part I/Create a Playlist App With the Spotify API (Part One) – Project/create-react-app/Jamming/src/Components/App/App.js’