Skip to content

Commit

Permalink
fix: publish button doesn't change its state when clicking
Browse files Browse the repository at this point in the history
  • Loading branch information
JokeUrSelf committed Sep 8, 2024
1 parent f802410 commit a9c9d59
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
16 changes: 14 additions & 2 deletions resources/js/components/QuizzesPanel/QuizComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,22 @@ function updateQuiz() {
}
function schedule() {
if (!isReadyToSchedule.value) return
request.sendRequest(`/admin/quizzes/${quizRef.value.id}/lock`,{method:'post'})
request.sendRequest(
`/admin/quizzes/${quizRef.value.id}/lock`,
{
method:'post',
preserveState: false,
},
)
}
function unSchedule() {
request.sendRequest(`/admin/quizzes/${quizRef.value.id}/unlock`,{method:'post'})
request.sendRequest(
`/admin/quizzes/${quizRef.value.id}/unlock`,
{
method:'post',
preserveState: false,
},
)
}
function deleteQuestion(question:CleanQuestion){
quizRef.value.questions = quizRef.value.questions.filter((q:CleanQuestion) => q !== question)
Expand Down
2 changes: 1 addition & 1 deletion resources/js/scripts/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ export class Request{
public errors = ref<Record<string,string>>({})
sendRequest(url : string, payload : VisitPayload) {
payload = {
...payload,
preserveScroll: true,
preserveState: true,
onStart: () => {this.errors.value = {}; this.isRequestOngoing.value = true},
onFinish: () => this.isRequestOngoing.value = false,
onError: (errors:Record<string,string>) => this.errors.value = errors,
...payload,
}
router.visit(url, payload)
}
Expand Down

0 comments on commit a9c9d59

Please sign in to comment.