visuddhinanda 3 лет назад
Родитель
Сommit
e46439f007
1 измененных файлов с 7 добавлено и 1 удалено
  1. 7 1
      dashboard/src/request.ts

+ 7 - 1
dashboard/src/request.ts

@@ -63,7 +63,13 @@ export const delete_ = async <R>(path: string): Promise<R> => {
   const res: R = await response.json();
   return res;
 };
-
+export const delete_2 = async <Q, R>(path: string, body: Q): Promise<R> => {
+  const data = options("DELETE");
+  data.body = JSON.stringify(body);
+  const response = await fetch(backend(path), data);
+  const res: R = await response.json();
+  return res;
+};
 // https://github.github.io/fetch/#options
 export const post = async <Q, R>(path: string, body: Q): Promise<R> => {
   const data = options("POST");