Revert "v0.2.1 (#157)" (#158)

This reverts commit a899f46464.
This commit is contained in:
Hayden
2021-02-10 19:39:46 -09:00
committed by GitHub
parent a899f46464
commit 8221c36a89
82 changed files with 895 additions and 937 deletions

View File

@@ -1,20 +1,23 @@
const baseURL = "/api/";
import axios from "axios";
import utils from "@/utils";
import store from "../store/store";
// look for data.snackbar in response
function processResponse(response) {
try {
utils.notify.show(response.data.snackbar.text, response.data.snackbar.type);
store.commit("setSnackBar", {
text: response.data.snackbar.text,
type: response.data.snackbar.type,
});
} catch (err) {
return;
}
return;
}
const apiReq = {
post: async function(url, data) {
let response = await axios.post(url, data).catch(function(error) {
post: async function (url, data) {
let response = await axios.post(url, data).catch(function (error) {
if (error.response) {
processResponse(error.response);
return error.response;
@@ -24,19 +27,8 @@ const apiReq = {
return response;
},
put: async function(url, data) {
let response = await axios.put(url, data).catch(function(error) {
if (error.response) {
processResponse(error.response);
return response;
} else return;
});
processResponse(response);
return response;
},
get: async function(url, data) {
let response = await axios.get(url, data).catch(function(error) {
put: async function (url, data) {
let response = await axios.put(url, data).catch(function (error) {
if (error.response) {
processResponse(error.response);
return response;
@@ -46,8 +38,19 @@ const apiReq = {
return response;
},
delete: async function(url, data) {
let response = await axios.delete(url, data).catch(function(error) {
get: async function (url, data) {
let response = await axios.get(url, data).catch(function (error) {
if (error.response) {
processResponse(error.response);
return response;
} else return;
});
// processResponse(response);
return response;
},
delete: async function (url, data) {
let response = await axios.delete(url, data).catch(function (error) {
if (error.response) {
processResponse(error.response);
return response;

View File

@@ -5,10 +5,10 @@ const prefix = baseURL + "themes";
const settingsURLs = {
allThemes: `${baseURL}themes`,
specificTheme: themeName => `${prefix}/${themeName}`,
specificTheme: (themeName) => `${prefix}/${themeName}`,
createTheme: `${prefix}/create`,
updateTheme: themeName => `${prefix}/${themeName}`,
deleteTheme: themeName => `${prefix}/${themeName}`,
updateTheme: (themeName) => `${prefix}/${themeName}`,
deleteTheme: (themeName) => `${prefix}/${themeName}`,
};
export default {
@@ -33,7 +33,6 @@ export default {
colors: colors,
};
let response = await apiReq.put(settingsURLs.updateTheme(themeName), body);
console.log(response.data);
return response.data;
},

View File

@@ -1,7 +1,7 @@
import { apiReq } from "./api-utils";
export default {
// import api from "@/api";
// import api from "../api";
async uploadFile(url, fileObject) {
let response = await apiReq.post(url, fileObject, {
headers: {