You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

51 lines
1.5 KiB

  1. import * as React from "react";
  2. import * as HttpUtils from "utils/HttpUtils";
  3. import * as UrlUtils from "utils/ApiPathConst";
  4. import { useNavigate } from "react-router-dom";
  5. import Loadable from 'components/Loadable';
  6. const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent')));
  7. // ==============================|| DASHBOARD - DEFAULT ||============================== //
  8. const Index = () => {
  9. const navigate = useNavigate()
  10. React.useEffect(() => {
  11. getPrfile();
  12. }, []);
  13. function getPrfile(){
  14. let params = new URLSearchParams(window.location.search)
  15. if(params.get("code")){
  16. HttpUtils.post({
  17. url: UrlUtils.GET_SMART_PROFILE,
  18. params:{
  19. code: params.get("code")
  20. },
  21. onSuccess: (responseData) => {
  22. navigate('/iAmSmartRegisterFrom', { state: { responseData: responseData } });
  23. },
  24. onFail: (response)=>{
  25. console.log("Fail");
  26. console.log(response);
  27. window.location.assign("/register");
  28. },
  29. onError:(error)=>{
  30. console.log(error);
  31. window.location.assign("/register");
  32. }
  33. });
  34. }else{
  35. window.location.assign("/register");
  36. }
  37. }
  38. return (
  39. <LoadingComponent />
  40. );
  41. };
  42. export default Index;