add payments method list

This commit is contained in:
smanylov
2026-04-02 17:59:47 +07:00
parent d6dee3361e
commit 0097f768ef
6 changed files with 102 additions and 1 deletions
+30
View File
@@ -0,0 +1,30 @@
'use server'
import { API_BASE_URL } from '@/app/actions/definitions';
import { getSessionData } from '@/app/actions/session';
export async function getPaymentsMethods() {
const token = await getSessionData('token');
console.log('getPaymentsMethods');
try {
const response = await fetch(`${API_BASE_URL}/api/payments/methods`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': `Bearer ${token}`,
}
});
if (response.ok) {
const parsed = await response.json();
console.log(parsed);
return parsed;
} else {
return null
}
} catch (error) {
return null
}
}