Skip to content

Commit

Permalink
chore: change createGlobalState to createSharedComposable (#1496)
Browse files Browse the repository at this point in the history
Co-authored-by: Kutasina Elena <62027488+ekuvirto@users.noreply.github.com>
Co-authored-by: NaMax66 <Maxim.Naidovich@virtoway.com>
  • Loading branch information
3 people authored Jan 6, 2025
1 parent 7420b51 commit c6a8377
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 44 deletions.
10 changes: 3 additions & 7 deletions client-app/builder-preview/builder-preview.plugin.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useGlobalInterceptors } from "@/core/api/common";
import { Logger } from "@/core/utilities";
import { useStaticPage, useTemplates } from "@/shared/static-content";
import { useStaticPage } from "@/shared/static-content";
import { templateBlocks } from "@/shared/static-content/components";
import ScrollToElement from "./scroll-to-element.vue";
import type { IThemeConfig } from "@/core/types";
Expand All @@ -12,7 +12,6 @@ import StaticPage from "@/pages/static-page.vue";
templateBlocks["scroll-to"] = ScrollToElement;

const { staticPagePreview } = useStaticPage();
const { setTemplate } = useTemplates();

declare type TransferDataType = {
template: IPageTemplate;
Expand Down Expand Up @@ -43,11 +42,8 @@ async function updatePreview(data: TransferDataType, options: { router: Router }
await options.router.push("/designer-preview");
}
staticPagePreview.value = newTemplate;
} else {
if (templateUrl) {
await options.router.push(templateUrl);
}
setTemplate(data.templateKey, newTemplate);
} else if (templateUrl) {
await options.router.push(templateUrl);
}
templateUrl = undefined;
}
Expand Down
5 changes: 1 addition & 4 deletions client-app/core/composables/useImpersonate.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { createGlobalState } from "@vueuse/core";
import { ref } from "vue";
import { useI18n } from "vue-i18n";
import { useFetch } from "@/core/api/common";
Expand All @@ -8,7 +7,7 @@ import { TabsType, useBroadcast, reloadAndOpenMainPage } from "@/shared/broadcas
import { useNotifications } from "@/shared/notification";
import type { ConnectTokenResponseType } from "../types";

export function _useImpersonate() {
export function useImpersonate() {
const { setTokenType, setAccessToken, setExpiresAt, setRefreshToken } = useAuth();
const broadcast = useBroadcast();
const status = ref();
Expand Down Expand Up @@ -65,5 +64,3 @@ export function _useImpersonate() {
status,
};
}

export const useImpersonate = createGlobalState(_useImpersonate);
2 changes: 0 additions & 2 deletions client-app/shared/static-content/composables/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
export * from "./useStaticPage";
export * from "./useTemplate";
export * from "./useTemplates";
10 changes: 0 additions & 10 deletions client-app/shared/static-content/composables/useTemplate.ts

This file was deleted.

21 changes: 0 additions & 21 deletions client-app/shared/static-content/composables/useTemplates.ts

This file was deleted.

0 comments on commit c6a8377

Please sign in to comment.