import { actions } from 'astro:actions';
import { actionErrorPopup } from '@util/action.ts';

export async function uuidFromUsername(edition: 'java' | 'bedrock', username: string) {
  const { data, error } = await actions.tools.uuidFromUsername({ edition: edition, username: username });
  if (error) {
    actionErrorPopup(error);
    return null;
  }

  return data.uuid;
}
