2020-05-13 10:54:35 +08:00
|
|
|
import type { Paginator } from '@/scripts/types'
|
|
|
|
|
2018-08-06 09:30:54 +08:00
|
|
|
export function flushPromises() {
|
2020-05-13 10:54:35 +08:00
|
|
|
return new Promise((resolve) => setImmediate(resolve))
|
|
|
|
}
|
|
|
|
|
|
|
|
export function createPaginator<T>(data: T[]): Paginator<T> {
|
|
|
|
return {
|
|
|
|
data,
|
|
|
|
total: data.length,
|
|
|
|
from: 1,
|
|
|
|
to: data.length,
|
|
|
|
current_page: 1,
|
|
|
|
last_page: 1,
|
|
|
|
}
|
2018-08-06 09:30:54 +08:00
|
|
|
}
|