mirror of
https://github.com/drawdb-io/drawdb.git
synced 2025-05-24 02:09:17 +00:00
clean up .env.sample and gist apis
This commit is contained in:
parent
d52bc9c741
commit
57dc31e60d
@ -1,2 +1 @@
|
|||||||
VITE_BACKEND_URL=http://backend.com
|
VITE_BACKEND_URL=http://backend.com
|
||||||
VITE_GITHUB_ACCESS_TOKEN=my_access_token
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user