summaryrefslogtreecommitdiff
path: root/src-migrate/services/promotionProgram.ts
blob: 8bf2a0bddeae744ed6d92ac2cf3cd001e07d3775 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { IPromotionProgram } from '~/types/promotionProgram';

export const getPromotionProgram = async (
  programId: number
): Promise<{ data: IPromotionProgram }> => {
  const url = `/api/promotion-program/${programId}`;
  return await fetch(url).then((res) => res.json());
};

export const getPromotionProgramSolr = async () => {
  const response = await fetch(`/solr/promotion_programs/select?indent=true&q.op=OR&q=*:*&fq=banner_s:[* TO *]`);
  if (!response.ok) {
    throw new Error('Network response was not ok');
  }
  return response.json();
};