mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-22 14:33:33 -07:00
refactor export const
This commit is contained in:
parent
af046b515d
commit
79daa7aef5
13 changed files with 36 additions and 36 deletions
|
@ -13,7 +13,7 @@ const backupURLs = {
|
|||
downloadBackup: fileName => `${backupBase}${fileName}/download`,
|
||||
};
|
||||
|
||||
export default {
|
||||
export const backupAPI = {
|
||||
/**
|
||||
* Request all backups available on the server
|
||||
* @returns {Array} List of Available Backups
|
||||
|
|
|
@ -10,7 +10,7 @@ const groupsURLs = {
|
|||
update: id => `${groupPrefix}/${id}`,
|
||||
};
|
||||
|
||||
export default {
|
||||
export const groupAPI = {
|
||||
async allGroups() {
|
||||
let response = await apiReq.get(groupsURLs.groups);
|
||||
return response.data;
|
||||
|
|
|
@ -1,33 +1,33 @@
|
|||
import backup from "./backup";
|
||||
import recipe from "./recipe";
|
||||
import mealplan from "./mealplan";
|
||||
import settings from "./settings";
|
||||
import themes from "./themes";
|
||||
import migration from "./migration";
|
||||
import myUtils from "./upload";
|
||||
import { backupAPI } from "./backup";
|
||||
import { recipeAPI } from "./recipe";
|
||||
import { mealplanAPI } from "./mealplan";
|
||||
import { settingsAPI } from "./settings";
|
||||
import { themeAPI } from "./themes";
|
||||
import { migrationAPI } from "./migration";
|
||||
import { utilsAPI } from "./upload";
|
||||
import { categoryAPI, tagAPI } from "./category";
|
||||
import meta from "./meta";
|
||||
import users from "./users";
|
||||
import signUps from "./signUps";
|
||||
import groups from "./groups";
|
||||
import siteSettings from "./siteSettings";
|
||||
import { metaAPI } from "./meta";
|
||||
import { userAPI } from "./users";
|
||||
import { signupAPI } from "./signUps";
|
||||
import { groupAPI } from "./groups";
|
||||
import { siteSettingsAPI } from "./siteSettings";
|
||||
|
||||
/**
|
||||
* The main object namespace for interacting with the backend database
|
||||
*/
|
||||
export const api = {
|
||||
recipes: recipe,
|
||||
siteSettings: siteSettings,
|
||||
backups: backup,
|
||||
mealPlans: mealplan,
|
||||
settings: settings,
|
||||
themes: themes,
|
||||
migrations: migration,
|
||||
utils: myUtils,
|
||||
recipes: recipeAPI,
|
||||
siteSettings: siteSettingsAPI,
|
||||
backups: backupAPI,
|
||||
mealPlans: mealplanAPI,
|
||||
settings: settingsAPI,
|
||||
themes: themeAPI,
|
||||
migrations: migrationAPI,
|
||||
utils: utilsAPI,
|
||||
categories: categoryAPI,
|
||||
tags: tagAPI,
|
||||
meta: meta,
|
||||
users: users,
|
||||
signUps: signUps,
|
||||
groups: groups,
|
||||
meta: metaAPI,
|
||||
users: userAPI,
|
||||
signUps: signupAPI,
|
||||
groups: groupAPI,
|
||||
};
|
||||
|
|
|
@ -14,7 +14,7 @@ const mealPlanURLs = {
|
|||
shopping: planID => `${prefix}${planID}/shopping-list`,
|
||||
};
|
||||
|
||||
export default {
|
||||
export const mealplanAPI = {
|
||||
async create(postBody) {
|
||||
let response = await apiReq.post(mealPlanURLs.create, postBody);
|
||||
return response;
|
||||
|
|
|
@ -8,7 +8,7 @@ const debugURLs = {
|
|||
lastRecipe: `${prefix}/last-recipe-json`,
|
||||
};
|
||||
|
||||
export default {
|
||||
export const metaAPI = {
|
||||
async get_version() {
|
||||
let response = await apiReq.get(debugURLs.version);
|
||||
return response.data;
|
||||
|
|
|
@ -11,7 +11,7 @@ const migrationURLs = {
|
|||
import: (folder, file) => `${migrationBase}/${folder}/${file}/import`,
|
||||
};
|
||||
|
||||
export default {
|
||||
export const migrationAPI = {
|
||||
async getMigrations() {
|
||||
let response = await apiReq.get(migrationURLs.all);
|
||||
return response.data;
|
||||
|
|
|
@ -18,7 +18,7 @@ const recipeURLs = {
|
|||
updateImage: slug => `${prefix}${slug}/image`,
|
||||
};
|
||||
|
||||
export default {
|
||||
export const recipeAPI = {
|
||||
/**
|
||||
* Create a Recipe by URL
|
||||
* @param {string} recipeURL
|
||||
|
|
|
@ -9,7 +9,7 @@ const settingsURLs = {
|
|||
testWebhooks: `${settingsBase}/webhooks/test`,
|
||||
};
|
||||
|
||||
export default {
|
||||
export const settingsAPI = {
|
||||
async requestAll() {
|
||||
let response = await apiReq.get(settingsURLs.siteSettings);
|
||||
return response.data;
|
||||
|
|
|
@ -10,7 +10,7 @@ const signUpURLs = {
|
|||
createUser: token => `${signUpPrefix}/${token}`,
|
||||
};
|
||||
|
||||
export default {
|
||||
export const signupAPI = {
|
||||
async getAll() {
|
||||
let response = await apiReq.get(signUpURLs.all);
|
||||
return response.data;
|
||||
|
|
|
@ -11,7 +11,7 @@ const settingsURLs = {
|
|||
customPage: id => `${settingsBase}/custom-pages/${id}`,
|
||||
};
|
||||
|
||||
export default {
|
||||
export const siteSettingsAPI = {
|
||||
async get() {
|
||||
let response = await apiReq.get(settingsURLs.siteSettings);
|
||||
return response.data;
|
||||
|
|
|
@ -11,7 +11,7 @@ const settingsURLs = {
|
|||
deleteTheme: themeName => `${prefix}/${themeName}`,
|
||||
};
|
||||
|
||||
export default {
|
||||
export const themeAPI = {
|
||||
async requestAll() {
|
||||
let response = await apiReq.get(settingsURLs.allThemes);
|
||||
return response.data;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { apiReq } from "./api-utils";
|
||||
|
||||
export default {
|
||||
export const utilsAPI = {
|
||||
// import { api } from "@/api";
|
||||
async uploadFile(url, fileObject) {
|
||||
let response = await apiReq.post(url, fileObject, {
|
||||
|
|
|
@ -17,7 +17,7 @@ const usersURLs = {
|
|||
resetPassword: id => `${userPrefix}/${id}/reset-password`,
|
||||
};
|
||||
|
||||
export default {
|
||||
export const userAPI = {
|
||||
async login(formData) {
|
||||
let response = await apiReq.post(authURLs.token, formData, {
|
||||
headers: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue