public async uploadForRegister()

in source/frontend/src/services/photo-service.ts [81:107]


  public async uploadForRegister(photos: File[]): Promise<string[]> {
    const { results }: { results: { id: string; url: string }[] } = await Client.get(
      'api',
      `${this.resource}/upload_urls`,
      {
        queryStringParameters: {
          count: photos.length,
          type: 'register',
        },
      }
    );
    if (!results || results.length === 0) {
      throw new Error('upload url is empty');
    }
    const tasks = results.map(({ url }, index) =>
      fetch(url, {
        method: 'PUT',
        body: photos[index],
        mode: 'cors',
        headers: {
          'Content-Type': '',
        },
      })
    );
    await Promise.all(tasks);
    return results.map((result) => result.id);
  }