Skip to content

Commit

Permalink
refactor: remove some unused packages and refactor code
Browse files Browse the repository at this point in the history
  • Loading branch information
satyawikananda committed Mar 4, 2022
1 parent 2ca1e9f commit fd29f0a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 93 deletions.
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,14 @@
"dev": "vite --port 3333 --open",
"build": "vite build",
"serve": "vite preview",
"format": "prettier --write './**/*.{js,ts}'"
"format": "prettier --write ./**/*.ts"
},
"devDependencies": {
"@satyawikananda/prettier-config": "^0.0.3",
"@types/cheerio": "^0.22.31",
"@types/node": "^16.11.26",
"@types/node-fetch": "^2.6.1",
"axios": "^0.26.0",
"cheerio": "^1.0.0-rc.10",
"isomorphic-unfetch": "^3.1.0",
"prettier": "^2.5.1",
"query-string": "^7.1.1",
"typescript": "^4.3.2",
Expand Down
88 changes: 0 additions & 88 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions src/scrape/get-cities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ import { BASE_URL } from "~/const"
const agent = new Agent({ rejectUnauthorized: false })

export const getCities = async (provinceId: string): Promise<DataCities> => {
const data = await axios.get(`${BASE_URL}Kabkota?kode_propinsi=${provinceId}`, { httpsAgent: agent })
const { data } = await axios.get(`${BASE_URL}Kabkota?kode_propinsi=${provinceId}`, {
httpsAgent: agent,
})
return Promise.resolve({
cities: data.data.data.map((data: any) => ({
cities: data.data.map((data: any) => ({
id: data.kode_kabkota,
name: data.nama_kabkota,
})),
Expand Down

1 comment on commit fd29f0a

@vercel
Copy link

@vercel vercel bot commented on fd29f0a Mar 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.