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

  let galleryId;
  let work;

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

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