mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-08-04 21:15:22 +02:00
Feature/about api (#253)
* fix settings * app info cleanup Co-authored-by: hay-kot <hay-kot@pm.me>
This commit is contained in:
parent
fd21777990
commit
bc595d5cfa
7 changed files with 38 additions and 23 deletions
|
@ -53,7 +53,6 @@ import AddRecipeFab from "@/components/UI/AddRecipeFab";
|
|||
import LanguageMenu from "@/components/UI/LanguageMenu";
|
||||
import Vuetify from "./plugins/vuetify";
|
||||
import { user } from "@/mixins/user";
|
||||
import { api } from "./api";
|
||||
|
||||
export default {
|
||||
name: "App",
|
||||
|
@ -76,6 +75,10 @@ export default {
|
|||
isMobile() {
|
||||
return this.$vuetify.breakpoint.name === "xs";
|
||||
},
|
||||
demo() {
|
||||
const appInfo = this.$store.getters.getAppInfo;
|
||||
return appInfo.demoStatus;
|
||||
},
|
||||
},
|
||||
|
||||
created() {
|
||||
|
@ -96,14 +99,11 @@ export default {
|
|||
this.$store.dispatch("requestTags");
|
||||
this.darkModeSystemCheck();
|
||||
this.darkModeAddEventListener();
|
||||
|
||||
const api_status = await api.meta.getIsDemo();
|
||||
this.demo = api_status.demoStatus;
|
||||
this.$store.dispatch("requestAppInfo");
|
||||
},
|
||||
|
||||
data: () => ({
|
||||
search: false,
|
||||
demo: false,
|
||||
}),
|
||||
methods: {
|
||||
// For Later!
|
||||
|
@ -166,7 +166,6 @@ export default {
|
|||
opacity: 0.9 !important;
|
||||
}
|
||||
|
||||
|
||||
*::-webkit-scrollbar {
|
||||
width: 0.25rem;
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ const debugURLs = {
|
|||
};
|
||||
|
||||
export const metaAPI = {
|
||||
async get_version() {
|
||||
async getAppInfo() {
|
||||
let response = await apiReq.get(debugURLs.version);
|
||||
return response.data;
|
||||
},
|
||||
|
|
|
@ -83,7 +83,7 @@
|
|||
<v-list-item-content>
|
||||
<v-list-item-title>
|
||||
{{ $t("settings.current") }}
|
||||
{{ version }}
|
||||
{{ appVersion }}
|
||||
</v-list-item-title>
|
||||
<v-list-item-subtitle>
|
||||
<a
|
||||
|
@ -106,14 +106,12 @@
|
|||
import { validators } from "@/mixins/validators";
|
||||
import { initials } from "@/mixins/initials";
|
||||
import { user } from "@/mixins/user";
|
||||
import { api } from "@/api";
|
||||
import axios from "axios";
|
||||
export default {
|
||||
mixins: [validators, initials, user],
|
||||
data() {
|
||||
return {
|
||||
latestVersion: null,
|
||||
version: null,
|
||||
hideImage: false,
|
||||
showSidebar: false,
|
||||
mobile: false,
|
||||
|
@ -163,8 +161,6 @@ export default {
|
|||
this.mobile = this.viewScale();
|
||||
this.showSidebar = !this.viewScale();
|
||||
this.getVersion();
|
||||
let versionData = await api.meta.get_version();
|
||||
this.version = versionData.version;
|
||||
},
|
||||
|
||||
computed: {
|
||||
|
@ -172,7 +168,11 @@ export default {
|
|||
return `api/users/${this.user.id}/image`;
|
||||
},
|
||||
newVersionAvailable() {
|
||||
return this.latestVersion == this.version ? false : true;
|
||||
return this.latestVersion == this.appVersion ? false : true;
|
||||
},
|
||||
appVersion() {
|
||||
const appInfo = this.$store.getters.getAppInfo;
|
||||
return appInfo.version;
|
||||
},
|
||||
},
|
||||
|
||||
|
|
|
@ -28,6 +28,10 @@ const store = new Vuex.Store({
|
|||
mealPlanCategories: [],
|
||||
allCategories: [],
|
||||
allTags: [],
|
||||
appInfo: {
|
||||
version: "",
|
||||
demoStatus: false,
|
||||
},
|
||||
},
|
||||
|
||||
mutations: {
|
||||
|
@ -43,6 +47,9 @@ const store = new Vuex.Store({
|
|||
setAllTags(state, payload) {
|
||||
state.allTags = payload;
|
||||
},
|
||||
setAppInfo(state, payload) {
|
||||
state.appInfo = payload;
|
||||
},
|
||||
},
|
||||
|
||||
actions: {
|
||||
|
@ -67,6 +74,11 @@ const store = new Vuex.Store({
|
|||
const tags = await api.tags.getAll();
|
||||
commit("setAllTags", tags);
|
||||
},
|
||||
|
||||
async requestAppInfo({ commit }) {
|
||||
const response = await api.meta.getAppInfo();
|
||||
commit("setAppInfo", response);
|
||||
},
|
||||
},
|
||||
|
||||
getters: {
|
||||
|
@ -76,6 +88,7 @@ const store = new Vuex.Store({
|
|||
state.allCategories.sort((a, b) => (a.slug > b.slug ? 1 : -1)),
|
||||
getAllTags: state =>
|
||||
state.allTags.sort((a, b) => (a.slug > b.slug ? 1 : -1)),
|
||||
getAppInfo: state => state.appInfo,
|
||||
},
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue