| | |
| | | import {onMounted, reactive, ref} from "vue" |
| | | import {useRoute} from "vue-router" |
| | | import Pagination from "../components/Pagination.vue" |
| | | import {getUsers} from "@/lib/api" |
| | | |
| | | const route = useRoute() |
| | | const userId = route.params.userId |
| | |
| | | ///////////////////////////////////////////////////////////////////////// |
| | | |
| | | async function init (offset = 0) { |
| | | const res = await fetch(`/api/users?offset=${offset}&limit=${limit}&token=jiuGfr432898D90290kjfsldkfn3hh8F`) |
| | | const data = await res.json() |
| | | // const res = await fetch(`/api/users?offset=${offset}&limit=${limit}&token=jiuGfr432898D90290kjfsldkfn3hh8F`) |
| | | // const data = await res.json() |
| | | const data = await getUsers(offset, limit) |
| | | console.log(data) |
| | | if (res.status === 200) { |
| | | Object.assign(users,data) |
| | | } |
| | | else { |
| | | error.value = `ERROR: ${res.status}` |
| | | } |
| | | } |
| | | |
| | | function go (offset) { |