first commit
This commit is contained in:
8
resources/js/plugins/fake-api/utils/genId.js
Normal file
8
resources/js/plugins/fake-api/utils/genId.js
Normal file
@@ -0,0 +1,8 @@
|
||||
export const genId = array => {
|
||||
const { length } = array
|
||||
let lastIndex = 0
|
||||
if (length)
|
||||
lastIndex = Number(array[length - 1]?.id) + 1
|
||||
|
||||
return lastIndex || (length + 1)
|
||||
}
|
1
resources/js/plugins/fake-api/utils/paginateArray.js
Normal file
1
resources/js/plugins/fake-api/utils/paginateArray.js
Normal file
@@ -0,0 +1 @@
|
||||
export const paginateArray = (array, perPage, page) => array.slice((page - 1) * perPage, page * perPage)
|
Reference in New Issue
Block a user