Refreshing Navigation In VUEJS - vue.js

Assume that Home, Login and Register links in my navigation. After login, I want to hide or remove Login and Registration Links and instead want to display Logout and Dashboard Menu.
It works when I refresh the page. What is the best way to do that programmatically?

With this code you can refresh page with JavaScript:
// like an HTTP redirect
window.location.replace("/");
// like clicking on a link
window.location.href = "/";
This will redirect to your home page. If you want you can replace / with any address you want.

You can use vue-router to specify components in each view or you can use v-if or v-show directives to programmatically change flags of code blocks.

Related

How to Change /SignIn, /SignOut , and /Account pages parent page or Add these page to a child of custom page instead of Home?

I'm using a PowerApps portal that has login and logout pages which has parent page as home. But I need to change the parent page to my custom page. Is it possible to change the parent page?
Because in our scenario all page URLs should be derived from a custom page. Can you please help as soon as possible.
Now the URL is https://xxxxx.powerappsportals.com/en-US/SignIn
I want to achieve like https://xxxxx.powerappsportals.com/en-US/yyy/SignIn - yyy should be my custom page partial URL.

Can I use Vue router to link to a div instead of a page?

I'm trying to create a route for an overlay. This overlay is toggled when pressing a button in my nav. Since its background is transparent/blur, it cannot be a separate site.
My goal is to make google register this path on my sitemap, therefore displaying it as a site link in its search results.
I am using Gridsome.

Show modal automatically if theres a query parameter in url Vue

Is there a way to open a modal automatically by first evaluate the URL for parameters?
For example:
Visitors to the site with URL : example.com don't see the modal. They just see the regular site.
Visitors to the site with URL example.com?token=abcd123 or example.com/token=abcd123 see the regular example.com site, but with a special modal over the top when the page loads.
How do you do this with vue?
If you are using Vue Router, you can extract the parameter from the route object.
console.log(this.$route.query.token) // abcd123
If you can extract it, you can see if token has any value, and if it does, display the modal. Do the logic inside the mounted() method.

Carousel is null on web page in Stencil theme

When creating a custom Page Template for use as Home Page, "Display as Home Page
Yes, display this page as the home page of my store " the "carousel" data element is null, making it impossible to use stencil CLI. Is there a work-around for this?
You'll want to be sure to include carousel: true in the front matter for your page.html template. The custom template you create will pick up its context from page.html. Hope that helps!

Sitecore - Prevent access to a page, but still show it in the navigation

In Sitecore I have denied access to a particular page for the anonymous user.
This works correctly, but it also means that the page does not appear in the navigation menus and sitemap (both XSLT).
What I would like is for the user to be able to see the link, but be redirected to a Register/Login page when they click on it.
You'd need to allow anonymous users to view the page for it to be visible in the menu and sitemap.
What you could do though is override the Sitecore.Pipelines.HttpRequest.HttpRequestProcessor to check if the page requires a login (by adding a RequiresLogin True/False to the template for example), then check if the user is logged in if not redirect to your login page.
Theres an example of overriding the HttpRequestProcessor here
You could wrap the rendering logic in the menus in a SecurityDisabler, so it would render all item links, even if the user "cant see" them.
using (SecurityDisabler disabler = new SecurityDisabler())
{
foreach (Item item in Sitecore.Context.Item.Children)
{
... render the link ...
}
}