|
|
|
@ -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)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|