Skip to content

Commit

Permalink
feat: add default return url setting (#1165)
Browse files Browse the repository at this point in the history
  • Loading branch information
NaMax66 committed Jul 5, 2024
1 parent b2dad89 commit 53777e1
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
4 changes: 3 additions & 1 deletion client-app/broadcast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useApolloClient } from "@vue/apollo-composable";
import { useRouter } from "vue-router";
import { filterActiveQueryNames } from "@/core/api/graphql";
import { OperationNames } from "@/core/api/graphql/types";
import { useThemeContext } from "@/core/composables";
import { DEFAULT_NOTIFICATION_DURATION } from "@/core/constants";
import { globals } from "@/core/globals";
import { getReturnUrlValue } from "@/core/utilities";
Expand Down Expand Up @@ -36,6 +37,7 @@ export function setupBroadcastGlobalListeners() {
const notifications = useNotifications();
const { fetchUser, user } = useUser();
const { signMeOut } = useSignMeOut({ reloadPage: false });
const { themeContext } = useThemeContext();

on(pageReloadEvent, () => location.reload());
on(reloadAndOpenMainPage, () => {
Expand Down Expand Up @@ -86,7 +88,7 @@ export function setupBroadcastGlobalListeners() {
});
});
on(openReturnUrl, () => {
location.href = getReturnUrlValue() ?? "/";
location.href = getReturnUrlValue() ?? themeContext.value.settings.default_return_url ?? "/";
});

on(forbiddenEvent, () => {
Expand Down
1 change: 1 addition & 0 deletions client-app/core/types/theme-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ export interface IThemeConfigPreset {
color_footer_bottom_link?: string;
color_footer_bottom_link_hover?: string;
isCVVinSkyflowRequired?: boolean;
default_return_url?: string;
}

export interface IThemeConfig {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
ref="bottomHeader"
class="relative z-[2] flex min-h-[5.5rem] items-center gap-x-5 bg-inherit px-5 py-3 xl:px-12"
>
<router-link to="/">
<router-link :to="$context.settings.default_return_url ?? '/'">
<VcImage :src="logoUrl" :alt="$context.storeName" class="h-8 xl:h-[2.8rem]" lazy />
</router-link>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<VcIcon class="text-[--color-primary-500]" name="menu" :size="32" />
</button>

<router-link to="/">
<router-link :to="$context.settings.default_return_url ?? '/'">
<VcImage :src="logoUrl" :alt="$context.storeName" class="h-8" lazy />
</router-link>
</div>
Expand Down
15 changes: 10 additions & 5 deletions config/settings_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
"checkout_coupon_enabled": true,
"checkout_gifts_enabled": true,

"isCVVinSkyflowRequired": false,

"default_return_url": "/",

"logo_image": "/static/images/common/logo.svg",
"logo_inverted_image": "/static/images/common/logo-white.svg",
"favicon_image": "/static/icons/favicon-32x32.png",
Expand Down Expand Up @@ -248,8 +252,7 @@
"color_info_950": "#0E212A",

"color_additional_50": "#FFFFFF",
"color_additional_950": "#000000",
"isCVVinSkyflowRequired": false
"color_additional_950": "#000000"
},

"Watermelon": {
Expand Down Expand Up @@ -293,6 +296,10 @@
"checkout_coupon_enabled": true,
"checkout_gifts_enabled": true,

"isCVVinSkyflowRequired": false,

"default_return_url": "/",

"logo_image": "/static/images/common/logo.svg",
"logo_inverted_image": "/static/images/common/logo-white.svg",
"favicon_image": "/static/icons/favicon-32x32.png",
Expand Down Expand Up @@ -515,9 +522,7 @@
"color_footer_top_bg": "#332829",

"color_footer_bottom_bg": "#141010",
"color_footer_bottom_link": "#d4c9c9",

"isCVVinSkyflowRequired": false
"color_footer_bottom_link": "#d4c9c9"
}
}
}

0 comments on commit 53777e1

Please sign in to comment.