Skip to content

Instantly share code, notes, and snippets.

View hargun0360's full-sized avatar
🥇
Focusing

Hargun Singh hargun0360

🥇
Focusing
View GitHub Profile
@hargun0360
hargun0360 / RestAxiosService.js
Created July 9, 2023 07:57
A Comprehensive Overview of How to Handle Refresh Token Using a Custom Function.
import axios from "axios"; // Import axios library for HTTP requests
// API_URLs
const BASE_URL = "http://117.55.243.59:8000/api/"; // Base URL
const REFRESH_TOKEN = BASE_URL + 'token/refresh/'; // Refresh token API endpoint
// Function to fetch Auth Token from Local Storage
export function getAuthToken(key = "access_token") {
// Fetch token from local storage
return localStorage.getItem(key);