mirror of
https://github.com/ivabus/gui
synced 2025-04-24 14:37:11 +03:00

* #245 implement push notification using pushy * #298 subscribe to installed package --------- Co-authored-by: neil <neil@neils-MacBook-Pro.local>
31 lines
636 B
TypeScript
31 lines
636 B
TypeScript
import axios from "axios";
|
|
import path from "path";
|
|
|
|
const base = "https://api.tea.xyz";
|
|
export async function get<T>(urlPath: string) {
|
|
const url = new URL(path.join("v1", urlPath), base).toString();
|
|
// TODO: add headers
|
|
const req = await axios.request<T>({
|
|
method: "GET",
|
|
url,
|
|
headers: {}
|
|
});
|
|
|
|
return req.data;
|
|
}
|
|
|
|
export async function post<T>(urlPath: string, data: { [key: string]: any }) {
|
|
const url = new URL(path.join("v1", urlPath), base).toString();
|
|
const req = await axios.request<T>({
|
|
method: "POST",
|
|
url,
|
|
headers: {},
|
|
data
|
|
});
|
|
|
|
console.log("REQ:", req.data);
|
|
|
|
return req.data;
|
|
}
|
|
|
|
export default get;
|