Added ellipsis to loading status string

This commit is contained in:
Dmitriy Shishkov 2023-07-13 17:43:41 +03:00
parent 619fd952a5
commit d041df0bbd
Signed by: dm1sh
GPG Key ID: 027994B0AA357688
3 changed files with 6 additions and 6 deletions

View File

@ -8,7 +8,7 @@ type AddError = typeof addErrors[number]
const isAddError = (obj: unknown): obj is AddError => isLiteralUnion(obj, addErrors) const isAddError = (obj: unknown): obj is AddError => isLiteralUnion(obj, addErrors)
const buttonStates = ["Опубликовать", "Загрузка", "Опубликовано", "Отменено"] as const const buttonStates = ["Опубликовать", "Загрузка...", "Опубликовано", "Отменено"] as const
type ButtonState = typeof buttonStates[number] | AddError type ButtonState = typeof buttonStates[number] | AddError
type AddResponse = { type AddResponse = {
@ -26,14 +26,14 @@ const useAddAnnouncement = () => {
const abortControllerRef = useRef<AbortController>() const abortControllerRef = useRef<AbortController>()
const doAdd = async (formData: FormData) => { const doAdd = async (formData: FormData) => {
if (status === "Загрузка") { if (status === "Загрузка...") {
abortControllerRef.current?.abort() abortControllerRef.current?.abort()
setStatus("Отменено") setStatus("Отменено")
timerIdRef.current = setTimeout(() => setStatus("Опубликовать"), 3000) timerIdRef.current = setTimeout(() => setStatus("Опубликовать"), 3000)
return return
} }
setStatus("Загрузка") setStatus("Загрузка...")
const abortController = new AbortController() const abortController = new AbortController()
abortControllerRef.current = abortController abortControllerRef.current = abortController

View File

@ -13,7 +13,7 @@ const isBookResponse = (obj: unknown): obj is BookResponse => isObject(obj, {
"Success": "boolean" "Success": "boolean"
}) })
type BookStatus = "" | "Загрузка" | "Забронировано" | "Ошибка бронирования" type BookStatus = "" | "Загрузка..." | "Забронировано" | "Ошибка бронирования"
function useBook(id: number) { function useBook(id: number) {
const navigate = useNavigate() const navigate = useNavigate()
@ -24,7 +24,7 @@ function useBook(id: number) {
const token = getToken() const token = getToken()
if (token) { if (token) {
setStatus("Загрузка") setStatus("Загрузка...")
try { try {

View File

@ -159,7 +159,7 @@ function AddPage() {
{trashboxes.loading {trashboxes.loading
? ( ? (
<div style={{ height: 400 }}> <div style={{ height: 400 }}>
<p>Загрузка</p> <p>Загрузка...</p>
</div> </div>
) : ( ) : (
trashboxes.error ? ( trashboxes.error ? (