|
1 | 1 | 'use server' |
2 | 2 | import axios from 'axios' |
3 | 3 | import type z from 'zod' |
4 | | -import type { Level2Keys } from '@/lib/helpers/typescriptTyping' |
5 | 4 | import { subscribeSchema } from '@/lib/zodSchemas/zodSchemas' |
6 | 5 | import { validateFormRequest } from '../api/forms/validateFormRequest' |
| 6 | +import { newsletterCategoryLocale, newsletterCategoryMap } from '@/types/newsLetterTypes' |
7 | 7 |
|
8 | 8 | const MAKE_SUBSCRIBER_API_BASE_URL = process.env.MAKE_SUBSCRIBER_API_BASE_URL |
9 | 9 | const MAKE_API_KEY = process.env.MAKE_API_KEY || '' |
10 | 10 | const SUBSCRIBER_LIST_ID_EN = process.env.MAKE_SUBSCRIBER_LIST_ID_EN |
11 | 11 | const SUBSCRIBER_LIST_ID_NO = process.env.MAKE_SUBSCRIBER_LIST_ID_NO |
12 | 12 | const MAKE_API_USER = process.env.MAKE_API_USERID || '' |
13 | 13 |
|
14 | | -export const newsletterCategoryMap = { |
15 | | - no: { |
16 | | - generalNews: 'generelle nyheter', |
17 | | - Company: 'generelle nyheter', |
18 | | - crudeOilAssays: 'crude oil assays', |
19 | | - Crude: 'crude oil assays', |
20 | | - magazineStories: 'magasinsaker', |
21 | | - stockMarketAnnouncements: 'børsmeldinger', |
22 | | - Stock: 'børsmeldinger', |
23 | | - }, |
24 | | - en: { |
25 | | - generalNews: 'general news', |
26 | | - Company: 'general news', |
27 | | - crudeOilAssays: 'crude oil assays', |
28 | | - Crude: 'crude oil assays', |
29 | | - magazineStories: 'magazine stories', |
30 | | - stockMarketAnnouncements: 'stock market announcements', |
31 | | - Stock: 'stock market announcements', |
32 | | - }, |
33 | | -} |
34 | | - |
35 | | -export type newsletterCategoryLocale = keyof typeof newsletterCategoryMap |
36 | | -export type newsletterCategoryKeys = Level2Keys<typeof newsletterCategoryMap> |
37 | | - |
38 | 14 | const subscriberApi = axios.create({ |
39 | 15 | baseURL: MAKE_SUBSCRIBER_API_BASE_URL, |
40 | 16 | headers: { |
|
0 commit comments