Squeegee Portal
  • Introduction
  • Getting started
  • Integrating the Widgets
  • Common Issues
  • Available Components
    • Component Previewer
    • Today's Appointment
    • Upcoming Appointments
    • Appointment History
    • Financial History
    • My Ratings
    • Chat
    • Automatic Payments
    • All Quotes
    • Book Appointment
    • Welcome Card
    • Address Search
    • Profile
    • Edit Profile Button
    • Stripe Pre-pay
    • Quote Flow
    • Sign-in
    • Sign-out
  • Appearance
    • Themes
    • Custom Themes
  • Utils
    • refreshPortal
  • Migrating Old Layouts
Powered by GitBook
On this page

Was this helpful?

  1. Utils

refreshPortal

This document assumes you already have a solid understanding of basic Web Development technologies such as JavaScript, React, HTML & CSS.

Refresh Portal Event

The refreshPortal event is essential when dividing the portal into specialized pages, such as a sign-in page or an alternate layout. We recommend you trigger this event whenever the user's location changes to ensure they always have the latest information.

Usage example

window.dispatchEvent(new Event('refreshPortal'));

React + Next.js example

This example demonstrates a root-level component that monitors the user's location and triggers the refreshPortal event whenever there is a change. This example is utilising

'use client';
import React from 'react';
import { usePathname } from 'next/navigation';

export const PortalRefreshHandler = ({ children }: { children: React.ReactNode }) => {
  const pathname = usePathname();
  React.useEffect(() => window.dispatchEvent(new Event('refreshPortal')), [pathname]);

  return <>{children}</>;
};
PreviousCustom ThemesNextMigrating Old Layouts

Last updated 12 months ago

Was this helpful?