clean up .env.sample and gist apis

This commit is contained in:
1ilit 2025-04-21 22:02:53 +04:00
parent d52bc9c741
commit 57dc31e60d
2 changed files with 7 additions and 8 deletions

View File

@ -1,2 +1 @@
VITE_BACKEND_URL=http://backend.com VITE_BACKEND_URL=http://backend.com
VITE_GITHUB_ACCESS_TOKEN=my_access_token

View File

@ -3,8 +3,10 @@ import axios from "axios";
const filename = "share.json"; const filename = "share.json";
const description = "drawDB diagram"; const description = "drawDB diagram";
const baseUrl = import.meta.env.VITE_BACKEND_URL;
export async function create(content) { export async function create(content) {
const res = await axios.post(`${import.meta.env.VITE_BACKEND_URL}/gists`, { const res = await axios.post(`${baseUrl}/gists`, {
public: false, public: false,
filename, filename,
description, description,
@ -15,20 +17,18 @@ export async function create(content) {
} }
export async function patch(gistId, content) { export async function patch(gistId, content) {
await axios.patch(`${import.meta.env.VITE_BACKEND_URL}/gists/${gistId}`, { await axios.patch(`${baseUrl}/gists/${gistId}`, {
filename, filename,
content, content,
}); });
} }
export async function del(gistId) { export async function del(gistId) {
await axios.delete(`${import.meta.env.VITE_BACKEND_URL}/gists/${gistId}`); await axios.delete(`${baseUrl}/gists/${gistId}`);
} }
export async function get(gistId) { export async function get(gistId) {
const res = await axios.get( const res = await axios.get(`${baseUrl}/gists/${gistId}`);
`${import.meta.env.VITE_BACKEND_URL}/gists/${gistId}`,
);
return res.data; return res.data;
} }