Skip to content

Instantly share code, notes, and snippets.

View SirojbekMaqsudov's full-sized avatar
🎯
Focusing

Sirojbek Maqsudov SirojbekMaqsudov

🎯
Focusing
View GitHub Profile
@SirojbekMaqsudov
SirojbekMaqsudov / .bash_profile
Created June 29, 2024 10:31
Github CLI Automation
gh_pr() {
local base_branch=${1:-dev}
local head_branch=$2
if [ -z "$head_branch" ]; then
head_branch=$(git rev-parse --abbrev-ref HEAD)
fi
if gh pr create -f --base "$base_branch" --head "$head_branch"; then
echo "Pull so'rovi yaratildi"
@SirojbekMaqsudov
SirojbekMaqsudov / api.js
Last active April 6, 2024 21:49
next-auth token refresh rotation and axios interceptor
import axios from "axios";
import {getCsrfToken, getSession, signOut} from "next-auth/react";
const refreshToken = async (token) => {
const response = await fetch(`${process.env.API_URL}/auth/refresh`, {
method: 'POST',
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json'
}