export type UpdateMetadataInput = { isUsernamePublic: boolean } export async function updateIsUsernamePublic (data: UpdateMetadataInput): Promise { const res = await fetch('/api/user/metadata', { method: 'POST', body: JSON.stringify({ isUsernamePublic: data.isUsernamePublic }) }) const d = await res.json() if (!res.ok) throw new Error(`failed to updateIsUsernamePublic. ${res.status} ${res.statusText}`); return d }