Skip to content

Commit

Permalink
fix: providing correct link, fixing naming in routes
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Moravec committed Sep 5, 2024
1 parent a535c5d commit 8106923
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions frontend/src/app.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Route, Router } from '@solidjs/router'
import { Quiz } from 'quiz.tsx'
import QuizForm from './pages/CreateQuestion/CreateQuestion.tsx'
import { CreateQuestion } from './pages/CreateQuestion/CreateQuestion.tsx'
import { QuestionList } from 'questions.tsx'

export const App = () => (
<Router>
<Route path="/quiz/:id" component={Quiz} />
<Route path="/create-question" component={QuizForm} />
<Route path="/create-question" component={CreateQuestion} />
<Route path="/quiz-question/all" component={QuestionList} />
</Router>
)
8 changes: 3 additions & 5 deletions frontend/src/pages/CreateQuestion/CreateQuestion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type Question = {
quizType: string
}

function QuizForm() {
export function CreateQuestion() {
const [question, setQuestion] = createSignal<string>('')
const [answers, setAnswers] = createSignal<string[]>(['', '', '', ''])
const [correctAnswer, setCorrectAnswer] = createSignal<number | null>(null)
Expand Down Expand Up @@ -38,7 +38,7 @@ function QuizForm() {
})
.then(data => {
console.log('Success:', data) // Handle the response data
setLinkToQuestion(`http://localhost/quiz/${data}`)
setLinkToQuestion(`${location.origin}/quiz/${data}`)
})
.catch(error => {
console.error('Error:', error) // Handle errors
Expand Down Expand Up @@ -132,10 +132,8 @@ function QuizForm() {
Submit
</button>{' '}
<br />
<span>{linkToQuestion()}</span>
<span id="question-link">{linkToQuestion()}</span>
</form>
)
}
}

export default QuizForm

0 comments on commit 8106923

Please sign in to comment.