|
@@ -1,7 +1,7 @@
|
|
|
import { store } from "@/store";
|
|
|
import { appType } from "./types";
|
|
|
import { defineStore } from "pinia";
|
|
|
-import { getConfig } from "@/config";
|
|
|
+import { getConfig, responsiveStorageNameSpace } from "@/config";
|
|
|
import { deviceDetection, storageLocal } from "@pureadmin/utils";
|
|
|
|
|
|
export const useAppStore = defineStore({
|
|
@@ -9,15 +9,17 @@ export const useAppStore = defineStore({
|
|
|
state: (): appType => ({
|
|
|
sidebar: {
|
|
|
opened:
|
|
|
- storageLocal().getItem<StorageConfigs>("responsive-layout")
|
|
|
- ?.sidebarStatus ?? getConfig().SidebarStatus,
|
|
|
+ storageLocal().getItem<StorageConfigs>(
|
|
|
+ `${responsiveStorageNameSpace()}layout`
|
|
|
+ )?.sidebarStatus ?? getConfig().SidebarStatus,
|
|
|
withoutAnimation: false,
|
|
|
isClickCollapse: false
|
|
|
},
|
|
|
|
|
|
layout:
|
|
|
- storageLocal().getItem<StorageConfigs>("responsive-layout")?.layout ??
|
|
|
- getConfig().Layout,
|
|
|
+ storageLocal().getItem<StorageConfigs>(
|
|
|
+ `${responsiveStorageNameSpace()}layout`
|
|
|
+ )?.layout ?? getConfig().Layout,
|
|
|
device: deviceDetection() ? "mobile" : "desktop",
|
|
|
|
|
|
sortSwap: false
|
|
@@ -32,8 +34,9 @@ export const useAppStore = defineStore({
|
|
|
},
|
|
|
actions: {
|
|
|
TOGGLE_SIDEBAR(opened?: boolean, resize?: string) {
|
|
|
- const layout =
|
|
|
- storageLocal().getItem<StorageConfigs>("responsive-layout");
|
|
|
+ const layout = storageLocal().getItem<StorageConfigs>(
|
|
|
+ `${responsiveStorageNameSpace()}layout`
|
|
|
+ );
|
|
|
if (opened && resize) {
|
|
|
this.sidebar.withoutAnimation = true;
|
|
|
this.sidebar.opened = true;
|
|
@@ -48,7 +51,7 @@ export const useAppStore = defineStore({
|
|
|
this.sidebar.isClickCollapse = !this.sidebar.opened;
|
|
|
layout.sidebarStatus = this.sidebar.opened;
|
|
|
}
|
|
|
- storageLocal().setItem("responsive-layout", layout);
|
|
|
+ storageLocal().setItem(`${responsiveStorageNameSpace()}layout`, layout);
|
|
|
},
|
|
|
async toggleSideBar(opened?: boolean, resize?: string) {
|
|
|
await this.TOGGLE_SIDEBAR(opened, resize);
|