fix: Ancora fix sul BASE_URL

pull/1/head
Antonio De Lucreziis 2 years ago
parent c3b014b50a
commit bd01bc9085

@ -12,7 +12,7 @@ import { ProfilePage } from './pages/Profile'
const Redirect = ({ to }: { to: string }) => {
useEffect(() => {
route(to, true)
route(prependBaseUrl(to), true)
}, [])
return (

@ -2,7 +2,7 @@ import { route } from 'preact-router'
import { useState } from 'preact/hooks'
import { isAdministrator, isStudent, Solution as SolutionModel, SolutionId } from '../../shared/model'
import { sortByStringKey } from '../../shared/utils'
import { server } from '../api'
import { prependBaseUrl, server } from '../api'
import { Header } from '../components/Header'
import { MarkdownEditor } from '../components/MarkdownEditor'
import { Select } from '../components/Select'
@ -16,7 +16,7 @@ const CreateProblem = ({}) => {
content: source,
})
route(`/problem/${id}`)
route(prependBaseUrl(`/problem/${id}`))
}
return (
@ -32,9 +32,9 @@ type SortOrder = 'latest' | 'oldest'
export const AdminPage = ({}) => {
const [user] = useCurrentUser(user => {
if (!user) {
route('/login', true)
route(prependBaseUrl('/login'), true)
} else if (isStudent(user.role)) {
route('/', true)
route(prependBaseUrl('/'), true)
}
})

@ -1,6 +1,7 @@
import { route } from 'preact-router'
import { useState } from 'preact/hooks'
import { prependBaseUrl } from '../api.js'
import { Header } from '../components/Header.jsx'
export const LoginPage = () => {
@ -18,7 +19,7 @@ export const LoginPage = () => {
}),
})
route('/')
route(prependBaseUrl('/'))
}
return (

@ -1,7 +1,7 @@
import { route } from 'preact-router'
import { useState } from 'preact/hooks'
import { isAdministrator, Solution as SolutionModel, User } from '../../shared/model'
import { server } from '../api'
import { prependBaseUrl, server } from '../api'
import { Header } from '../components/Header'
import { Select } from '../components/Select'
import { Solution } from '../components/Solution'
@ -22,13 +22,13 @@ const SolutionList = ({ user }: { user: User }) => {
export const ProfilePage = ({}) => {
const [user, logout] = useCurrentUser(user => {
if (!user) {
route('/login', true)
route(prependBaseUrl('/login'), true)
}
})
const handleLogout = () => {
logout()
route('/')
route(prependBaseUrl('/'))
}
return (

Loading…
Cancel
Save