“Jak wrócić do poprzedniej trasy po uwierzytelnianiu w NextJS” Kod odpowiedzi

Jak wrócić do poprzedniej trasy po uwierzytelnianiu w NextJS

 componentDidMount() { // and/or componentDidUpdate, depending on what you're trying to do
      if (!auth) {
         Router.push({
               pathname: '/login',
               query: { from: {router.pathname} },
         }))
     }
   }

//Then on the login page, after successful login:
    handlePostLoginOk = () => {
          const { router } = this.props;
          if (router.query && router.query.from) {
               router.push(router.query.from);
        }
  }
Zakariyau Abdullahi

Jak wrócić do poprzedniej trasy po uwierzytelnianiu w NextJS

 componentDidMount() { // and/or componentDidUpdate, depending on what you're trying to do
      if (!auth) {
         Router.push({
               pathname: '/login',
               query: { from: {router.pathname} },
         }))
     }
   }

//Then on the login page, after successful login:
    handlePostLoginOk = () => {
          const { router } = this.props;
          if (router.query && router.query.from) {
               router.push(router.query.from);
        }
  }
Zakariyau Abdullahi

Jak wrócić do poprzedniej trasy po uwierzytelnianiu w NextJS

 componentDidMount() { // and/or componentDidUpdate, depending on what you're trying to do
      if (!auth) {
         Router.push({
               pathname: '/login',
               query: { from: {router.pathname} },
         }))
     }
   }

//Then on the login page, after successful login:
    handlePostLoginOk = () => {
          const { router } = this.props;
          if (router.query && router.query.from) {
               router.push(router.query.from);
        }
  }
Zakariyau Abdullahi

Jak wrócić do poprzedniej trasy po uwierzytelnianiu w NextJS

 componentDidMount() { // and/or componentDidUpdate, depending on what you're trying to do
      if (!auth) {
         Router.push({
               pathname: '/login',
               query: { from: {router.pathname} },
         }))
     }
   }

//Then on the login page, after successful login:
    handlePostLoginOk = () => {
          const { router } = this.props;
          if (router.query && router.query.from) {
               router.push(router.query.from);
        }
  }
Zakariyau Abdullahi

Jak wrócić do poprzedniej trasy po uwierzytelnianiu w NextJS

 componentDidMount() { // and/or componentDidUpdate, depending on what you're trying to do
      if (!auth) {
         Router.push({
               pathname: '/login',
               query: { from: {router.pathname} },
         }))
     }
   }

//Then on the login page, after successful login:
    handlePostLoginOk = () => {
          const { router } = this.props;
          if (router.query && router.query.from) {
               router.push(router.query.from);
        }
  }
Zakariyau Abdullahi

Jak wrócić do poprzedniej trasy po uwierzytelnianiu w NextJS

 componentDidMount() { // and/or componentDidUpdate, depending on what you're trying to do
      if (!auth) {
         Router.push({
               pathname: '/login',
               query: { from: {router.pathname} },
         }))
     }
   }

//Then on the login page, after successful login:
    handlePostLoginOk = () => {
          const { router } = this.props;
          if (router.query && router.query.from) {
               router.push(router.query.from);
        }
  }
Zakariyau Abdullahi

Jak wrócić do poprzedniej trasy po uwierzytelnianiu w NextJS

 componentDidMount() { // and/or componentDidUpdate, depending on what you're trying to do
      if (!auth) {
         Router.push({
               pathname: '/login',
               query: { from: {router.pathname} },
         }))
     }
   }

//Then on the login page, after successful login:
    handlePostLoginOk = () => {
          const { router } = this.props;
          if (router.query && router.query.from) {
               router.push(router.query.from);
        }
  }
Zakariyau Abdullahi

Jak wrócić do poprzedniej trasy po uwierzytelnianiu w NextJS

 componentDidMount() { // and/or componentDidUpdate, depending on what you're trying to do
      if (!auth) {
         Router.push({
               pathname: '/login',
               query: { from: {router.pathname} },
         }))
     }
   }

//Then on the login page, after successful login:
    handlePostLoginOk = () => {
          const { router } = this.props;
          if (router.query && router.query.from) {
               router.push(router.query.from);
        }
  }
Zakariyau Abdullahi

Jak wrócić do poprzedniej trasy po uwierzytelnianiu w NextJS

 componentDidMount() { // and/or componentDidUpdate, depending on what you're trying to do
      if (!auth) {
         Router.push({
               pathname: '/login',
               query: { from: {router.pathname} },
         }))
     }
   }

//Then on the login page, after successful login:
    handlePostLoginOk = () => {
          const { router } = this.props;
          if (router.query && router.query.from) {
               router.push(router.query.from);
        }
  }
Zakariyau Abdullahi

Jak wrócić do poprzedniej trasy po uwierzytelnianiu w NextJS

 componentDidMount() { // and/or componentDidUpdate, depending on what you're trying to do
      if (!auth) {
         Router.push({
               pathname: '/login',
               query: { from: {router.pathname} },
         }))
     }
   }

//Then on the login page, after successful login:
    handlePostLoginOk = () => {
          const { router } = this.props;
          if (router.query && router.query.from) {
               router.push(router.query.from);
        }
  }
Zakariyau Abdullahi

Odpowiedzi podobne do “Jak wrócić do poprzedniej trasy po uwierzytelnianiu w NextJS”

Pytania podobne do “Jak wrócić do poprzedniej trasy po uwierzytelnianiu w NextJS”

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu