Git Product home page Git Product logo

code-wth-mosh-python-course's Introduction

Hi ๐Ÿ‘‹, I'm Dinujaya S...

A passionate MERN developer from Sri Lanka

  • ๐Ÿข Iโ€™m currently working as a Freelancer

  • ๐ŸŒฑ Iโ€™m currently learning React advance concepts and React Native

  • ๐Ÿ‘ฏ Iโ€™m looking to collaborate on Lodgelink.net

  • ๐Ÿ‘จโ€๐Ÿ’ป All of my projects are available at dinujaya.me

  • ๐Ÿ“ I regularly write blog posts on blog.dinujaya.me

  • ๐Ÿ’ฌ Ask me about anything related to Information and Communication Technology

  • ๐Ÿ“ซ How to reach me [email protected]

๐ŸŒ Socials:

Facebook LinkedIn Stack Overflow X YouTube

๐Ÿ’ป Tech Stack:

Apache Groovy C C# CSS3 Dart Go HTML5 JavaScript Markdown PHP PowerShell Python Rust Shell Script TypeScript Windows Terminal AWS Azure Firebase GithubPages Google Cloud Heroku Vercel Vultr Angular Anaconda Angular.js Bootstrap Bun Chakra Chart.js DaisyUI Deno JS Django Electron.js Expo Express.js FastAPI Flask Gulp JWT MUI NPM Next JS NodeJS PNPM Pug Qt React Native React React Query React Router React Hook Form Redux SASS Semantic UI React Socket.io Styled Components TailwindCSS Vite Vue.js Webpack WebGL Web3.js WordPress Yarn Apache Nginx Firebase MariaDB MicrosoftSQLServer MongoDB MySQL Postgres SQLite Supabase Adobe Adobe After Effects Adobe Audition Adobe Creative Cloud Adobe Fonts Adobe Illustrator Adobe Lightroom Adobe Lightroom Classic Adobe Photoshop Adobe Premiere Pro Adobe XD Figma AZUREDEVOPS ANSIBLE Docker Ansible Babel Docker Plex Kubernetes Notion Pi-Hole Postman TOR


Need to know more details about me. ๐Ÿ˜‹


Simple code to use my bio data API ( https://api.dinujaya.me/ ) hosted in DigitalOcean VPS

const API_BASE_URL = "https://api.dinujaya.me";

// Function to sign in and obtain access token
const signIn = async (
  username: string,
  password: string
): Promise<string | null> => {
  try {
    const response = await axios.post<{ accessToken: string }>(
      `${API_BASE_URL}/sign`,
      { username, password }
    );
    return response.data.accessToken;
  } catch (error) {
    console.error("Error signing in:", error);
    return null;
  }
};

// Function to get bio data using access token
const getBioData = async (accessToken: string): Promise<any> => {
  try {
    const response = await axios.get(`${API_BASE_URL}/`, {
      headers: {
        Authorization: `Bearer ${accessToken}`,
      },
    });
    return response.data;
  } catch (error) {
    console.error("Error fetching bio data:", error);
    return null;
  }
};

useEffect(() => {
  const getData = async () => {
    // Example usage
    const username = "your_username";
    const password = "your_password";

    // Sign in and obtain access token
    const accessToken = await signIn(username, password);

    if (accessToken) {
      // Get bio data using access token
      const bioData = await getBioData(accessToken);
      console.log("Dinu's details: :", bioData);
    } else {
      console.log("Failed to obtain access token.");
    }
  };

  getData();
}, []);

code-wth-mosh-python-course's People

Contributors

dinujaya-sandaruwan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.