Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static Pages #183

Merged
merged 4 commits into from
Apr 4, 2024
Merged

Static Pages #183

merged 4 commits into from
Apr 4, 2024

Conversation

Pilou97
Copy link
Collaborator

@Pilou97 Pilou97 commented Apr 4, 2024

Context

If you go on "/KT1/dashboard" (or proposals, etc...) you will hit a 404. If not try to reload your page.

It's because this code was deleted in #164

import { validateAddress, ValidationResult } from "@taquito/utils";
import Proposals from "./proposals";
import { GetServerSideProps } from "next";


export const getServerSideProps: GetServerSideProps = async ({ params }) => {
export default Proposals;
  if (!params || !params.walletAddress || Array.isArray(params.walletAddress))
    return { notFound: true };

  if (validateAddress(params.walletAddress) !== ValidationResult.VALID)
    return { notFound: true };

  return {
    redirect: {
      destination: `/${params.walletAddress}/dashboard`,
      permanent: true,
    },
  };
};

export default function WalletAddressIndex() {
  return null;
}

Solution

Each time the user is redirect to 404.html (by Github), we check if the page is a valid one and proceed to the redirection. I am not a huge fan of this solution because I am not sure if it's the way to do it with next.js

Copy link
Collaborator

@quentin-burg quentin-burg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Pilou97 Pilou97 merged commit ee37cd1 into main Apr 4, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants