• Techblog369, India
  • March 27, 2023

How To Configure A Sendinblue SMTP Relay in Postfix?

Fix Email Issues in CyberPanel with SMTP Relay Setup Free Method. First Create a email using your Cyberpanel Under Emai Tab Create Email Second go to the SSL tab and click …

Create a simple password strength indicator with JavaScript

You’ve probably seen many examples of password strength indicators around the web. They let users know the password they’re using is weak and indicate how the strength changes when it’s modified. …


import { useState } from 'react'
import Swal from 'sweetalert2';
function Addservice() {
   const [ServiceName, setName] = useState("");
   const [ServiceDesc, setDesc] = useState("");
   const [file, setFile] = useState("");
   async function Addservice() {
       // const token = localStorage.getItem("token")
       //const token = JSON.parse(localStorage.getItem('token'));
       const user = JSON.parse(localStorage.getItem('token'));
       const formData = new FormData();
       formData.append('ServiceName', ServiceName);
       formData.append('ServiceDesc', ServiceDesc);
       formData.append('file', file);

      await fetch(
               method: 'POST',
               body: formData,
                   // 'Authorization': "Bearer " + "139|qMtIApnGoPFxPGrEXGzKSEWTbbXrHXCAU5uuTar3"
                   'Authorization': 'Bearer ' + user.token,
           .then((response) => response.json())
           .then((result) => {
               console.log('Success:', result);
                   // icon: 'success',
                   title: 'Data Saved Successfully'
           .catch((error) => {
               console.error('Error:', error);
                   // icon: 'error',
                   title: 'All Field required',
                   text: error.text,


   return (

           <div className="col-sm-6 offset-sm-3 my-4">
               <h1 className="text-center">AddService</h1>
               <input type="text" onChange={event => setName(event.target.value)} placeholder="
                   Service Name" className="form-control" required="" />
               <br />
               <input type="text" onChange={event => setDesc(event.target.value)} placeholder="Service Description" className="form-control" />
               <br />
               <input type="file" onChange={event => setFile(event.target.files[0])} className="form-control" />
               <br />
               <button onClick={Addservice} className="btn btn-primary">Save</button>


export default Addservice

const user = JSON.parse(localStorage.getItem(‘token’));

We already set token, here we only get the token and set it into header


The JSON.parse() method parses a JSON string, constructing the JavaScript value or object described by the string. An optional reviver function can be provided to perform a transformation on the resulting object before it is returned.

                   // 'Authorization': "Bearer " + "139|qMtIApnGoPFxPGrEXGzKSEWTbbXrHXCAU5uuTar3"
                   'Authorization': 'Bearer ' + user.token,

Thanks for reading…



Leave a Reply

Your email address will not be published. Required fields are marked *