mirror of
https://github.com/ae-utbm/sith.git
synced 2025-02-27 09:57:09 +00:00
fix warning message display on subsequently loaded news
This commit is contained in:
parent
94d2c5660a
commit
01c92feb40
@ -54,7 +54,7 @@ document.addEventListener("alpine:init", () => {
|
|||||||
* Query the server to know the number of news dates that would be moderated
|
* Query the server to know the number of news dates that would be moderated
|
||||||
* if this one is moderated.
|
* if this one is moderated.
|
||||||
*/
|
*/
|
||||||
async nbModerated() {
|
async nbToModerate(): Promise<number> {
|
||||||
// What we want here is the count attribute of the response.
|
// What we want here is the count attribute of the response.
|
||||||
// We don't care about the actual results,
|
// We don't care about the actual results,
|
||||||
// so we ask for the minimum page size possible.
|
// so we ask for the minimum page size possible.
|
||||||
|
@ -83,7 +83,8 @@
|
|||||||
so it's still reasonable #}
|
so it's still reasonable #}
|
||||||
<div
|
<div
|
||||||
{% if news is integer or news is string %}
|
{% if news is integer or news is string %}
|
||||||
x-data="{ nbEvents: nbModerated() }"
|
x-data="{ nbEvents: 0 }"
|
||||||
|
x-init="nbEvents = await nbToModerate()"
|
||||||
{% else %}
|
{% else %}
|
||||||
x-data="{ nbEvents: {{ news.dates.count() }} }"
|
x-data="{ nbEvents: {{ news.dates.count() }} }"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user