come ottenere l’url della email inviata all’interno della cella [closed]

Buongiorno, ho uno script che invia una email dallo sheet1 e vorrei che dopo aver inviato la email mi riportasse il link nella cella della riga corrispondente della email inviata in modo da poter recuperare ogni volta.
vi sarei grato per un aiuto.
Grazie

sheet1

function sendEmail() {
var ss = SpreadsheetApp.getActiveSpreadsheet()
var sheet1=ss.getSheetByName('Foglio1');
var n=sheet1.getLastRow();
for (var i = 2; i < n+1 ; i++ ) {
var emailAddress = sheet1.getRange(i,1).getValue();

var html =  HtmlService.createTemplateFromFile('template').evaluate().getContent();
 

GmailApp.sendEmail(emailAddress, 'Document', 'Please see the message.', {
    htmlBody: html,
    name: "Sender Name", //On my testing, it looks "name" (Sender Name) is needed for the alias email to work and for the email to be sent to to recipient successfully
    
}); 
}
}
<!DOCTYPE html>
<html>
  <head>
    <base target="_top">
  </head>
  <body>
    Hallo
  </body>
</html>

In javascript is this bug? [duplicate]

Here iam trying to see out put of

var a = 10 + "5";

output: 105; and datatype= string when we use string with number it deal as string
but my question is when i try

var a = 10 – “5”;

output: 5 and datatype: number
how this work is this bug?

Is this vanilla JavaScript code refactorable? [closed]

This is my first time asking a question on StackOverflow! I was wondering if this code can be made more simple since there is some repetition. I am new to JS so I would like some direction in making it cleaner.

For example, I believe I can add multiple classes in one querySelector. But for the multiple if/else statements I have no idea.

Thanks in advance!

const year = document.querySelector(".copyright .copy-text p");
year.innerHTML = "Copyright" + " " + new Date().getFullYear() + " " + "-" + " " + "MAtech";
const isInViewport = function (elem) {
  const distance = elem.getBoundingClientRect();
  return (
    distance.top >= 0 &&
    distance.left >= 0 &&
    distance.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
    distance.right <= (window.innerWidth || document.documentElement.clientWidth)
  );
};
const copyright = document.querySelector(".copyright");
const services = [
  document.querySelector(".services2"),
  document.querySelector(".services3"),
  document.querySelector(".services4"),
  document.querySelector(".services5"),
  document.querySelector(".services6"),
  document.querySelector(".services7"),
  document.querySelector(".services8"),
  document.querySelector(".services9"),
  document.querySelector(".services10"),
];
let scrolled = false;
let scrollTimeout;
window.addEventListener("wheel", (e) => {
  const scrollHeight = window.document.documentElement.scrollTop;
  if (!scrolled) {
    scrolled = true;
    if (services[8] && services[4]) {
      if (e.deltaY > 0) {
        window.scrollBy(0, window.innerHeight);
      } else if (e.deltaY < 0) {
        const sec10 = document.querySelector(".services10");
        const distancesec10 = sec10.getBoundingClientRect();
        if (isInViewport(copyright)) {
          document.documentElement.scrollBy(0, distancesec10.top);
        } else {
          document.documentElement.scrollTo(0, scrollHeight - window.innerHeight);
        }
      }
    } else if (services[4] && services[3]) {
      if (e.deltaY > 0) {
        window.scrollBy(0, window.innerHeight);
      } else if (e.deltaY < 0) {
        const sec6 = document.querySelector(".services6");
        const distancesec6 = sec6.getBoundingClientRect();
        if (isInViewport(copyright)) {
          document.documentElement.scrollBy(0, distancesec6.top);
        } else {
          document.documentElement.scrollTo(0, scrollHeight - window.innerHeight);
        }
      }
    } else if (services[3] && services[2]) {
      if (e.deltaY > 0) {
        window.scrollBy(0, window.innerHeight);
      } else if (e.deltaY < 0) {
        const sec5 = document.querySelector(".services5");
        const distancesec5 = sec5.getBoundingClientRect();
        if (isInViewport(copyright)) {
          document.documentElement.scrollBy(0, distancesec5.top);
        } else {
          document.documentElement.scrollTo(0, scrollHeight - window.innerHeight);
        }
      }
    } else if (!services[3] && services[2]) {
      if (e.deltaY > 0) {
        window.scrollBy(0, window.innerHeight);
      } else if (e.deltaY < 0) {
        const sec4 = document.querySelector(".services4");
        const distancesec4 = sec4.getBoundingClientRect();
        if (isInViewport(copyright)) {
          document.documentElement.scrollBy(0, distancesec4.top);
        } else {
          document.documentElement.scrollTo(0, scrollHeight - window.innerHeight);
        }
      }
    } else if (!services[2] && services[1]) {
      if (e.deltaY > 0) {
        window.scrollBy(0, window.innerHeight);
      } else if (e.deltaY < 0) {
        const sec3 = document.querySelector(".services3");
        const distancesec3 = sec3.getBoundingClientRect();
        if (isInViewport(copyright)) {
          document.documentElement.scrollBy(0, distancesec3.top);
        } else {
          document.documentElement.scrollTo(0, scrollHeight - window.innerHeight);
        }
      }
    } else if (!services[1] && services[0]) {
      if (e.deltaY > 0) {
        window.scrollBy(0, window.innerHeight);
      } else if (e.deltaY < 0) {
        const sec2 = document.querySelector(".services2");
        const distancesec2 = sec2.getBoundingClientRect();
        if (isInViewport(copyright)) {
          document.documentElement.scrollBy(0, distancesec2.top);
        } else {
          document.documentElement.scrollTo(0, scrollHeight - window.innerHeight);
        }
      }
    }
  }
  clearTimeout(scrollTimeout);
  scrollTimeout = setTimeout(() => {
    scrolled = false;
  }, 500);
});
window.addEventListener("keydown", (e) => {
  const scrollHeight = window.document.documentElement.scrollTop;
  if (!scrolled) {
    scrolled = true;
    if (services[8] && services[4]) {
      if (e.keyCode === 40) {
        window.scrollBy(0, window.innerHeight);
      } else if (e.keyCode === 38) {
        const sec10 = document.querySelector(".services10");
        const distancesec10 = sec10.getBoundingClientRect();
        if (isInViewport(copyright)) {
          document.documentElement.scrollBy(0, distancesec10.top);
        } else {
          document.documentElement.scrollTo(0, scrollHeight - window.innerHeight);
        }
      }
    } else if (services[4] && services[3]) {
      if (e.keyCode === 40) {
        window.scrollBy(0, window.innerHeight);
      } else if (e.keyCode === 38) {
        const sec6 = document.querySelector(".services6");
        const distancesec6 = sec6.getBoundingClientRect();
        if (isInViewport(copyright)) {
          document.documentElement.scrollBy(0, distancesec6.top);
        } else {
          document.documentElement.scrollTo(0, scrollHeight - window.innerHeight);
        }
      }
    } else if (services[3] && services[2]) {
      if (e.keyCode === 40) {
        window.scrollBy(0, window.innerHeight);
      } else if (e.keyCode === 38) {
        const sec5 = document.querySelector(".services5");
        const distancesec5 = sec5.getBoundingClientRect();
        if (isInViewport(copyright)) {
          document.documentElement.scrollBy(0, distancesec5.top);
        } else {
          document.documentElement.scrollTo(0, scrollHeight - window.innerHeight);
        }
      }
    } else if (!services[3] && services[2]) {
      if (e.keyCode === 40) {
        window.scrollBy(0, window.innerHeight);
      } else if (e.keyCode === 38) {
        const sec4 = document.querySelector(".services4");
        const distancesec4 = sec4.getBoundingClientRect();
        if (isInViewport(copyright)) {
          document.documentElement.scrollBy(0, distancesec4.top);
        } else {
          document.documentElement.scrollTo(0, scrollHeight - window.innerHeight);
        }
      }
    } else if (!services[2] && services[1]) {
      if (e.keyCode === 40) {
        window.scrollBy(0, window.innerHeight);
      } else if (e.keyCode === 38) {
        const sec3 = document.querySelector(".services3");
        const distancesec3 = sec3.getBoundingClientRect();
        if (isInViewport(copyright)) {
          document.documentElement.scrollBy(0, distancesec3.top);
        } else {
          document.documentElement.scrollTo(0, scrollHeight - window.innerHeight);
        }
      }
    } else if (!services[1] && services[0]) {
      if (e.keyCode === 40) {
        window.scrollBy(0, window.innerHeight);
      } else if (e.keyCode === 38) {
        const sec2 = document.querySelector(".services2");
        const distancesec2 = sec2.getBoundingClientRect();
        if (isInViewport(copyright)) {
          document.documentElement.scrollBy(0, distancesec2.top);
        } else {
          document.documentElement.scrollTo(0, scrollHeight - window.innerHeight);
        }
      }
    }
  }
  clearTimeout(scrollTimeout);
  scrollTimeout = setTimeout(() => {
    scrolled = false;
  }, 500);
});
const choices = document.querySelectorAll(".arrow");
if (services[8]) {
  const spot = [
    ".services2",
    ".services3",
    ".services4",
    ".services5",
    ".services6",
    ".services7",
    ".services8",
    ".services9",
    ".services10",
    ".copyright",
  ];
  choices.forEach(function (item, index) {
    const elmnt = document.querySelector(spot[index]);
    item.addEventListener("click", () => {
      elmnt.scrollIntoView({
        block: "start",
      });
    });
  });
} else if (!services[8] && services[4]) {
  const spot = [".services2", ".services3", ".services4", ".services5", ".services6", ".copyright"];
  choices.forEach(function (item, index) {
    const elmnt = document.querySelector(spot[index]);
    item.addEventListener("click", () => {
      elmnt.scrollIntoView({
        block: "start",
      });
    });
  });
} else if (!services[4] && services[3]) {
  const spot = [".services2", ".services3", ".services4", ".services5", ".copyright"];
  choices.forEach(function (item, index) {
    const elmnt = document.querySelector(spot[index]);
    item.addEventListener("click", () => {
      elmnt.scrollIntoView({
        block: "start",
      });
    });
  });
} else if (!services[3] && services[2]) {
  const spot = [".services2", ".services3", ".services4", ".copyright"];
  choices.forEach(function (item, index) {
    const elmnt = document.querySelector(spot[index]);
    item.addEventListener("click", () => {
      elmnt.scrollIntoView({
        block: "start",
      });
    });
  });
} else if (!services[1] && services[0]) {
  const spot = [".services2", ".copyright"];
  choices.forEach(function (item, index) {
    const elmnt = document.querySelector(spot[index]);
    item.addEventListener("click", () => {
      elmnt.scrollIntoView({
        block: "start",
      });
    });
  });
}
const host = ["https://matech.gr/", "https://matech.gr/en/"];
if (window.location.href == host[0]) {
  const cookieBox = document.querySelector(".cookiebar"),
    acceptBtn = cookieBox.querySelector(".btn");
  acceptBtn.onclick = () => {
    document.cookie = "CookieBy=MAtech; max-age=" + 60 * 60 * 24 * 30;
    if (document.cookie) {
      cookieBox.style.display = "none";
    } else {
      alert(
        "Δεν είναι δυνατή η ρύθμιση του cookie! Παρακαλώ καταργήστε τον αποκλεισμό αυτού του ιστότοπου από τη ρύθμιση cookie του προγράμματος περιήγησής σας."
      );
    }
  };
  const checkCookie = document.cookie.indexOf("CookieBy=MAtech");
  checkCookie != -1 ? (cookieBox.style.display = "none") : (cookieBox.style.display = "block");
} else if (window.location.href == host[1]) {
  const cookieBox = document.querySelector(".cookiebar");
  const acceptBtn = cookieBox.querySelector(".btn");
  acceptBtn.onclick = () => {
    document.cookie = "CookieBy=MAtech; max-age=" + 60 * 60 * 24 * 30;
    if (document.cookie) {
      cookieBox.style.display = "none";
    } else {
      alert("The cookie cannot be set! Please unblock this site from your browser cookie setting.");
    }
  };
  const checkCookie = document.cookie.indexOf("CookieBy=MAtech");
  checkCookie != -1 ? (cookieBox.style.display = "none") : (cookieBox.style.display = "block");
}
const hosts = [
  "https://matech.gr/ilektrologikesergasies",
  "https://matech.gr/ydravlikesergasies",
  "https://matech.gr/systimataasfaleias",
  "https://matech.gr/ilektrikessyskeves",
  "https://matech.gr/privacypolicy",
  "https://matech.gr/en/electricalworks",
  "https://matech.gr/en/plumbingworks",
  "https://matech.gr/en/securitysystems",
  "https://matech.gr/en/electricalappliances",
  "https://matech.gr/en/privacypolicy",
];
if ([hosts[0],hosts[1],hosts[2],hosts[3],hosts[4],hosts[5],hosts[6],hosts[7],hosts[8],hosts[9]].includes(window.location.href)
) {
  window.addEventListener("load", function () {});
  const target = document.querySelector("footer");
  const scrollToTopBtn = document.querySelector(".scrollToTopBtn");
  const rootElement = document.documentElement;
  function callback(entries, observer) {
    entries.forEach((entry) => {
      if (entry.isIntersecting) {
        scrollToTopBtn.classList.add("showBtn");
      } else {
        scrollToTopBtn.classList.remove("showBtn");
      }
    });
  }
  function scrollToTop() {
    rootElement.scrollTo({
      top: 0,
      behavior: "smooth",
    });
  }
  scrollToTopBtn.addEventListener("click", scrollToTop);
  const observer = new IntersectionObserver(callback);
  observer.observe(target);
}

How to solve undefined error when trying to access a nested array in a React state variable?

I am trying to build a form in which you can dynamically add fields and subfields. As an example, my form looks like this:

    Store information:
      Name
      Items inventory: [] (this is the nested array part,
            you press a button and can add another item to the inventory)
            ***Buttons to add more items to this store***

      ***Buttons to add more stores***
    

The code I am using to achieve this looks like this:

function StoreForm() {
  const [storeInputs, setStoreInputs] = useState([
    { storeName: "", items: [{ itemName: "" }] },
  ]);
   ///...
    
    return (
        {storeInputs.map(store,index) => 
        {
            //input data here
            
            {storeInputs.items.map(item,i) => 
                {
                    //This is where it throws the undefined error
                    //do something
                }
            }
        }
    )
   
}

But I am getting an error when I try to access the nested array of items using map. I tried it with an empty array, as well as with the code that I have posted above.

I can’t for the life of me figure out what I am doing wrong. The closest explanation I have is that the state variable initializes the array in another pass of the renderer, but even if I do assign a value to the array at runtime, it still is considered undefined.

How to return a string from an array using React.js useState hook

I’m using the useState hook in React and am trying to return a string to display in an h1 element from an array every time I click a button to call a function.

I tried using a for loop to return the index of each array, however, my h1 element only displays the last index of the array. Here is my code:

import React, { useState } from "react";

export default function App() {
  const [state, setState] = useState("Start");

  const greeting = ["Hello", "World!"];

  function nextWord() {
    for (let i = 0; i < greeting.length; i++) {
      setState(greeting[i]);
    }
  }

  return (
    <>
      <h1>{state}</h1>
      <button onClick={nextWord}>+</button>
    </>
  );
}

As you can see, my nextWord function only displays the last item of my array on the h1 element. How do I get it to display index 0, index 1, etc… with each click of the button calling the nextWord function. (E.g., It will display “Hello” in the h1 the first click, and then “World” on the next click.)

How to overcome UNABLE_TO_GET_ISSUER_CERT_LOCALLY when installing sentry with npm or curl

enter image description here

curl -sL -k https://sentry.io/get-cli/ | bash

As you can see, i am even asking NOT to verify the certificate with -k, but still can’t install it.

This script will automatically install sentry-cli 1.72.2 for you.
Installation path: /usr/local/bin/sentry-cli curl: (60) SSL
certificate problem: unable to get local issuer certificate More
details here: https://curl.se/docs/sslcerts.html

curl failed to verify the legitimacy of the server and therefore could
not establish a secure connection to it. To learn more about this
situation and how to fix it, please visit the web page mentioned
above.

What can be causing the issue? I have the Same with npm and yarn, see below

npm install @sentry/cli
npm ERR! info sentry-cli Downloading from https://downloads.sentry-cdn.com/sentry-cli/1.72.2/sentry-cli-Windows-x86_64.exe
npm ERR! Error: Unable to download sentry-cli binary from https://downloads.sentry-cdn.com/sentry-cli/1.72.2/sentry-cli-Windows-x86_64.exe.
npm ERR! Error code: UNABLE_TO_GET_ISSUER_CERT_LOCALLY

I tried :

npm config set strict-ssl=false 
npm config set registry http://registry.npmjs.org/

albeit no success

From what i read here it might be a proxy problem. But how do i get to know but i don’t understand exactly how to know what is my proxy or the path the my pem certificate

Typescript error while array filtered on type

I have an array of number | undefineds and I want the max of this array, if any of them is a number. In order to do so I want to filter on the element being of type number, so that I can pass a numbers-only array to Math.max(...array)

(I know I shouldn’t Math.max on an desctructured empty array, so I’ll only do a math.max if there are 1 or more numeric values in the array)

const numbersArray: number[] = [a,b].filter((v) => typeof v === "number");

That works fine in runtime, but I get a typescript error saying that I cant assert numbersArray to be of type number[].

Type 'undefined[]' is not assignable to type 'number[]'.
  Type 'undefined' is not assignable to type 'number'.ts(2322)

What am I doing wrong here?

How to implement field-level complexity in graphql code-first approach?

I ran into such a problem when dealing with query complexity in GraphQL. The package I used is graphql-query-complexity.

App.js:

app.use(
  '/graphql',
  graphqlHTTP((req) => ({
    schema: schema,
    graphiql: true,
    validationRules: [
      createComplexityRule({
        estimators: [
          simpleEstimator({ defaultComplexity: 1 }),
        ],
        maximumComplexity: 20,
        },
      }),
    ]
  }))
);

It works well, but when I looked at other examples on the internet, I saw that they use Field-level complexity there. That is, they can set a different complexity for each field. But can’t understand it because they use TypeGraphQL server, I use express-graphql

Example were:

@Field({ complexity: 3 })
title: string;

But my express-graphql code-first approach code:

const PostTypes: { comment: GraphQLObjectType } = {
  post: new GraphQLObjectType({
    name: 'Post',
    fields: () => ({
      title: { type: graphql.GraphQLString },
    }),
  }),
};

export default PostTypes;

So, how can I implement this for my structure?

How to show div/form when select function executes in javascript?

I need some help on when my FullCalendar Select:function{} exectues I want to my div (form) to show. right now I implemented a alert/prompt to show. But I need help or guide me on what am I doing wrong in my code below. All I need is to show my div when I double click on the calendar, basically replace the prompt to the form. thank you for the help. here is my code.

Javascript snippet:

  select: function(info ) {
        let title = prompt("Event Content:");
        if (title) {
            calendar.addEvent({
                title: title,
                start: info.startStr,
                end: info.endStr
            })
        }
        calendar.unselect();
    },

HTML:

    <div class="modal fade" id="schedule-edit">
    <div class="modal-dialog">
        <div class="modal-content">
            <!-- Modal Header -->
            <div class="modal-header">
                <h4 class="modal-title">Add Task</h4>
                <button type="button" class="close" data-dismiss="modal">&times;</button>
            </div>
            <!-- Modal body -->
            <div class="modal-body">
               <form id="event-form">
                    <div class="form-group">
                        <label>Title:</label>
                        <input type="text"  name = "title" id="title" class="form-control">
                    </div>
                        <div class="form-group">
                        <label>Project:</label>
                        <input type="text" id="project" class="form-control">
                    </div>
                        <div class="form-group">
                        <label>Est. Time (hours)</label>
                        <input type="text" id="time" class="form-control" placeholder="(Examples: 3,12.5,5.75")>
                    </div>
                        <div class="form-group">
                        <label>Time Spent (hours)</label>
                        <input type="text" id ="timeSpent" class="form-control" placeholder="(Examples: 3,12.5,5.75")>
                    </div>
                       <div class="form-group">
                        <label>Description</label>
                       <!--Add rich text editor here -->
                               <div class="sample-toolbar" id="description">
        <a href="javascript:void(0)" onclick="format('bold')"><span class="fa fa-bold fa-fw"></span></a>
        <a href="javascript:void(0)" onclick="format('italic')"><span class="fa fa-italic fa-fw"></span></a>
        <a href="javascript:void(0)" onclick="format('insertunorderedlist')"><span class="fa fa-list fa-fw"></span></a>
        <a href="javascript:void(0)" onclick="setUrl()"><span class="fa fa-link fa-fw"></span></a>


</div>
   <div class="editor" id="sampleeditor"></div>
                             <div class="form-group">
                        <label>Priority</label>
 
                      <select class="form-control"  id='firstList' name='firstList' onclick="getFoodItem()">
    </select>
                    </div>
                           <div class="form-group">
                           <label>Start Date</label>
                               <br>
                    <input  type="date" id="myDate" placeholder="yyyy-MM-dd" />
                           </div>
                                <div class="form-group">
                           <label>Due Date</label>
                               <br>
                    <input type="date" id="myDue" placeholder="yyyy-MM-dd" />
                           </div>
                    </div>
                </form>


            </div> 


 

Discord.js v13 why is my tempmute command not working?

I’ve made a tempmute command for my discord bot and it almost works. It has quite a few foolproofing measures like preventing the bot from muting themselves, not working if the time isn’t specified and such. I am using the npm ms package to deal with the mute duration (https://www.npmjs.com/package/ms). when instead of specifying an amount of time I type in gibberish it works as intended and replies with the correct message. The problem is that when I type in a 100% correct command it responds asthough I didn’t specify the time correctly instead of muting the user for that amount of time. here’s how it looks. Any ideas as to why that is?
My code is here:

const ms = require('ms');
const { Permissions, MessageActionRow, UserFlags } = require('discord.js');

module.exports = {
    name: 'tempmute',
    description: "Temporarily mutes a user",
    execute(message, args)
    {
        const target = message.mentions.members.first();
        let muteRole = message.guild.roles.cache.find(role => role.name === "muted");
        if(message.member.permissions.has(Permissions.FLAGS.MODERATE_MEMBERS))
        {
            if(target)
            {
                let memberTarget = message.guild.members.cache.get(target.id);
                if(target.id == 'myBotsID')
                {
                    message.reply("I can't mute myself.")
                }
                else if(message.member == target)
                {
                    message.reply("You can't mute yourself!")
                }
                else if(memberTarget.permissions.has(Permissions.FLAGS.MODERATE_MEMBERS))
                {
                    message.channel.send(`<@${memberTarget.user.id}> has been muted for ${ms(ms(args[1]))}`);                
                }
                else 
                {
                    if(!args[1]) 
                    {
                        return message.reply("Time not specified.")
                    }
                    else
                    {
                        let time = ms(args[1])
                        memberTarget.roles.add(muteRole.id); 
                        try {
                            message.reply("<@" + memberTarget.user.id + ">" + "has been muted for " + ms(ms(args[1])).catch(console.error))
                            setTimeout(function () {
                                memberTarget.roles.remove(muteRole.id);
                            }, time);
                        } catch (err) {
                            message.reply("Can't transform that into milliseconds `"+args[1]+"`")
                            return
                        }
                    }
                }
            }
            else
            {
                message.reply("You have to mention a valid member of this server.")
            }
        }
        else
        {
            message.reply("You can't use that.")
        }
    }
}

React keys for an array of strings

I have a question. How can I generate key for array of string? It is not object, in object I could put id and it would solve the problem. So what should I do in just array? Indexes as key is not a good practice so I am stuck.

const ingredients = ['rice', 'curry', 'chicken]



    {props.ingredients.map((ingredient) => (
                <Box>{ingredient}</Box>
          ))}

How to allow user to change column name’s in AG-GRID?

I am looking to allow my users to change the column header names to whatever they would like in ag-grid. I am using the javascript implementation.

I could not find an example of anyone doing this on stack overflow or the documentation, my initial idea is to create a new header component and add my own code to handle it that way via the ag grid api.

I found this page
https://www.ag-grid.com/javascript-data-grid/component-header/

It does not appear to have the default header component as an example. And I would like to use that to start off with… So my question is either:

  1. Does anyone know of an example or better method which achieves what I am trying to do?
    Or
  2. Would anyone please be able to point me to where I could find the code of the default ag grid header component, which I can use to start off with, and alter using the example given in the documentation linked above.

How can I render the values ​of an array in sessionStorage?

I will try to be as specific as possible in my question.
I am allocating some values ​​(key-text) in the sessionStorage.
I am using a dynamic method to get the keys for each session.
Unfortunately, reading on various websites and asking for support from people more experienced than me, I still couldn’t solve my problem …
Anyone know how to get all sessionStorage values ​​obtained with a dynamic key ??

let  unique_id = Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
        
const [value,setValue] = useState({
            id:unique_id,
            payload: ' ',
        })
sessionStorage.setItem(value)