Skip to content

Commit

Permalink
feat(newuser.jsx): design preview mode ?force=true tag to bypass redi…
Browse files Browse the repository at this point in the history
…rect
  • Loading branch information
junglesub committed Aug 1, 2024
1 parent bf1b521 commit 44eab73
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/pages/NewUser.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useEffect, useState } from "react";
import { useRecoilValue, useResetRecoilState } from "recoil";
import { authJwtAtom } from "../recoil/auth/atoms";
import { Navigate, useNavigate } from "react-router-dom";
import { Navigate, useNavigate, useSearchParams } from "react-router-dom";
import { NewContainer } from "../styles/Container";
import styled from "styled-components";
import { pretendard, timesNewRoman } from "../styles/fonts";
Expand All @@ -14,6 +14,7 @@ import { fetchBe } from "../tools/api";

function NewUser() {
const navigate = useNavigate();
const [params] = useSearchParams();

const jwtValue = useRecoilValue(authJwtAtom);
const resetAuth = useResetRecoilState(authJwtAtom);
Expand All @@ -35,6 +36,10 @@ function NewUser() {
if (!jwtValue) return;
fetchBe(jwtValue, "/userDetail/get")
.then((json) => {
if (params.get("force") === "true") {
alert("Design preview mode.");
return;
}
if (json.weight) navigate("/");
})
.catch((e) => setUserDataError(e.message));
Expand Down

0 comments on commit 44eab73

Please sign in to comment.