{"size": 5699, "ext": "js", "max_stars_repo_path": "src/mocks/handlers/trainerListHandlers.js", "max_stars_repo_name": "gzacharski/AGH-Praca-inzynierska-front-end", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/mocks/handlers/trainerListHandlers.js", "max_issues_repo_name": "gzacharski/AGH-Praca-inzynierska-front-end", "max_issues_repo_issues_event_min_datetime": "2021-03-20T20:19:59.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-28T04:53:44.000Z", "max_forks_repo_path": "src/mocks/handlers/trainerListHandlers.js", "max_forks_repo_name": "gzacharski/AGH-praca-inzynierska", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 138, "max_forks_count": null, "avg_line_length": 61.2795698925, "max_line_length": 869, "alphanum_fraction": 0.5995788735}
import { rest } from 'msw';
import { nanoid } from 'nanoid';
import { NETWORK_ERROR } from 'src/main/data/messages';
import { accountServiceURL } from 'src/main/data/urls';

export const trainerListHandlers = [
   rest.get(`${accountServiceURL}/trainers`, (req, res, ctx) => {
      const error = req.url.searchParams.get('error');
      if (error === 'noConnection') {
         return res(
            ctx.status(500),
            ctx.delay(),
            ctx.json({ message: NETWORK_ERROR }),
         );
      }

      const status = req.url.searchParams.get('status');
      if (status === 'noTrainers') {
         return res(
            ctx.status(404),
            ctx.delay(),
            ctx.json({ message: 'Brak aktulanej oferty' }),
         );
      }

      return res(
         ctx.status(200),
         ctx.delay(),
         ctx.json([
            {
               userId: nanoid(),
               name: 'Joe',
               surname: 'Pesci',
               images: [
                  'https://images.unsplash.com/photo-1549476464-37392f717541?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=934&q=80',
                  'https://images.unsplash.com/photo-1613685044678-0a9ae422cf5a?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1001&q=80',
               ],
               avatar: 'https://fwcdn.pl/ppo/71/04/57104/449672.2.jpg',
               description: {
                  synopsis:
                     'Nigdy się nie poddawaj. Na wielkie rzeczy potrzeba czasu.',
                  trainings: [
                     { trainingId: nanoid(), title: 'Trening personalny' },
                     { trainingId: nanoid(), title: 'TRX' },
                  ],
               },
            },
            {
               userId: nanoid(),
               name: 'Al',
               surname: 'Pacino',
               images: [
                  'https://images.unsplash.com/photo-1613685044678-0a9ae422cf5a?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1001&q=80',
                  'https://images.unsplash.com/photo-1549476464-37392f717541?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=934&q=80',
               ],
               avatar: 'https://fwcdn.pl/ppo/28/34/2834/449663.2.jpg',
               description: {
                  // synopsis: 'Gdy potrzebujesz skorzystać jednorazowo z naszej siłowni',
                  full: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam non lorem a dolor gravida tincidunt. Duis bibendum ligula at scelerisque pellentesque. Interdum et malesuada fames ac ante ipsum primis in faucibus. Mauris scelerisque tortor nec aliquam ultrices. Fusce fermentum sed nulla sed venenatis. Curabitur vehicula tristique odio, in feugiat velit accumsan sed. Ut et fermentum purus, in euismod dui. Vestibulum vehicula mollis enim vitae porttitor. Nam in bibendum nunc. Curabitur suscipit faucibus dolor. Nam a felis mattis, tincidunt libero id, feugiat tellus. Praesent neque neque, aliquet at nisl ut, tristique tincidunt tellus. Phasellus rhoncus felis nec enim malesuada, et eleifend diam vehicula. Sed posuere, leo ac placerat sagittis, augue turpis rutrum sem, at efficitur quam elit ac augue. Sed rhoncus a nibh nec tincidunt.',
                  trainings: [
                     { trainingId: nanoid(), title: 'Trening personalny' },
                     { trainingId: nanoid(), title: 'TRX' },
                     { trainingId: nanoid(), title: 'Wiosła' },
                     { trainingId: nanoid(), title: 'Sztangi' },
                     { trainingId: nanoid(), title: 'Pilates' },
                  ],
               },
            },
            {
               userId: nanoid(),
               name: 'Redford',
               surname: 'Bowdry',
               images: [
                  'https://images.unsplash.com/photo-1599058917765-a780eda07a3e?ixid=MnwxMjA3fDB8MHxzZWFyY2h8ODd8fGZpdG5lc3N8ZW58MHx8MHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60',
                  'https://images.unsplash.com/photo-1549476464-37392f717541?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=934&q=80',
               ],
               avatar: 'https://fwcdn.pl/fph/10/29/1029/192816_1.2.jpg',
               description: {
                  synopsis:
                     'Jedyną osobą, która może cię zmotywować jesteś ty sam!',
                  full: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam non lorem a dolor gravida tincidunt. Duis bibendum ligula at scelerisque pellentesque. Interdum et malesuada fames ac ante ipsum primis in faucibus. Mauris scelerisque tortor nec aliquam ultrices. Fusce fermentum sed nulla sed venenatis. Curabitur vehicula tristique odio, in feugiat velit accumsan sed. Ut et fermentum purus, in euismod dui. Vestibulum vehicula mollis enim vitae porttitor. Nam in bibendum nunc. Curabitur suscipit faucibus dolor. Nam a felis mattis, tincidunt libero id, feugiat tellus. Praesent neque neque, aliquet at nisl ut, tristique tincidunt tellus. Phasellus rhoncus felis nec enim malesuada, et eleifend diam vehicula. Sed posuere, leo ac placerat sagittis, augue turpis rutrum sem, at efficitur quam elit ac augue. Sed rhoncus a nibh nec tincidunt.',
                  trainings: [
                     { trainingId: nanoid(), title: 'Trening personalny' },
                     { trainingId: nanoid(), title: 'Wiosła' },
                     { trainingId: nanoid(), title: 'Pilates' },
                  ],
               },
            },
         ]),
      );
   }),
];
