add new endpoint for tariffs

This commit is contained in:
smanylov
2026-02-09 17:28:03 +07:00
parent 1b57d589fb
commit 7d6882a006
2 changed files with 39 additions and 4 deletions
+34
View File
@@ -65,4 +65,38 @@ export async function getUserFilesInfo() {
} catch (error) {
console.error(`error: ${error}`);
}
}
export async function fetchTariffs() {
const token = await getSessionData('token');
try {
const response = await fetch(`${API_BASE_URL}/api/v1/data`, {
method: 'POST',
body: JSON.stringify({
version: 1,
msg_id: 30001,
message_body: {
action: 'get',
user_token: token
}
}),
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
});
if (response.ok) {
const parsed = await response.json()
if (parsed?.message_code === 0) {
return parsed.message_body?.tariffs;
} else {
return []
}
}
} catch (error) {
console.error('error');
}
}