feat: init payments config backend & dash frontend

This commit is contained in:
swve 2024-09-26 19:07:30 +02:00
parent 96e453a4de
commit deba63cc15
15 changed files with 774 additions and 14 deletions

View file

@ -0,0 +1,38 @@
import { getAPIUrl } from '@services/config/config';
import { RequestBodyWithAuthHeader, errorHandling } from '@services/utils/ts/requests';
export async function getPaymentConfigs(orgId: number, access_token: string) {
const result = await fetch(
`${getAPIUrl()}payments/${orgId}/config`,
RequestBodyWithAuthHeader('GET', null, null, access_token)
);
const res = await errorHandling(result);
return res;
}
export async function createPaymentConfig(orgId: number, data: any, access_token: string) {
const result = await fetch(
`${getAPIUrl()}payments/${orgId}/config`,
RequestBodyWithAuthHeader('POST', data, null, access_token)
);
const res = await errorHandling(result);
return res;
}
export async function updatePaymentConfig(orgId: number, id: string, data: any, access_token: string) {
const result = await fetch(
`${getAPIUrl()}payments/${orgId}/config`,
RequestBodyWithAuthHeader('PUT', data, null, access_token)
);
const res = await errorHandling(result);
return res;
}
export async function deletePaymentConfig(orgId: number, id: string, access_token: string) {
const result = await fetch(
`${getAPIUrl()}payments/${orgId}/config/${id}`,
RequestBodyWithAuthHeader('DELETE', null, null, access_token)
);
const res = await errorHandling(result);
return res;
}