1
0
Fork 0

potential fix for login not working on production

This commit is contained in:
Kim, Jimin 2021-09-13 21:42:14 +09:00
parent 5f216318bf
commit 49d381f315
2 changed files with 4 additions and 9 deletions

View file

@ -5,8 +5,6 @@ import { Layout } from "antd"
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
import { faExternalLinkAlt } from "@fortawesome/free-solid-svg-icons"
import axios from "axios"
const { Header } = Layout
const StyledLlamaBotText = styled.b`
@ -53,11 +51,12 @@ const Navbar = () => {
const [userName, setUserName] = useState("")
useEffect(() => {
axios
.get("/api/user-data")
window
.fetch("/api/user-data")
.then((data) => data.json())
.then((data) => {
setIsLoggedIn(true)
setUserName(`${data.data.username}#${data.data.discriminator}`)
setUserName(`${data.username}#${data.discriminator}`)
})
.catch()
}, [])

View file

@ -1,8 +1,6 @@
import React, { useState, Suspense, lazy } from "react"
import ReactDOM from "react-dom"
import axios from "axios"
import { BrowserRouter, Switch, Route } from "react-router-dom"
import Loader from "react-spinners/CircleLoader"
@ -18,8 +16,6 @@ import "antd/dist/antd.min.css"
import "./index.css" // must be loaded last
import styled from "styled-components"
axios.defaults.withCredentials = true
const Home = lazy(() => import("./routes/Home"))
const Dashboard = lazy(() => import("./routes/Dashboard"))
const Modules = lazy(() => import("./routes/Modules"))