import { configs } from "@/app/config/configs"; export type UpdateIsUsernamePublicInput = { isUsernamePublic: boolean; access_token: string; } export async function updateIsUsernamePublic (data: UpdateIsUsernamePublicInput): Promise { console.log(`upadateIsUernamePublic configs.nextUrl=${configs.nextUrl}`) const res = await fetch(`${configs.nextUrl}/api/profile`, { method: 'POST', body: JSON.stringify({ username_visibility: data.isUsernamePublic }) }) const d = await res.json() if (!res.ok) throw new Error(`failed to updateProfile. ${res.status} ${res.statusText}`); return d }