<script>
  import Work from '../content/Work.svelte';
  import { nhentaiGetWork } from '../../services/api';
  import SvelteButton from '../elements/SvelteButton.svelte';
  import { t } from '../../services/utils';

  let galleryId;
  let work;

  async function handleClick() {
    work = await nhentaiGetWork(galleryId);
  }
</script>

<div class="nhentai-get-work">
  <label><input type="text" placeholder="177013" bind:value="{galleryId}" /></label
  ><SvelteButton on:click="{handleClick}">{t('Get')}</SvelteButton>
  {#if work}
  <Work id="{work.id}" />
  {/if}
</div>
