generated from mantinedev/next-app-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
233,476 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
'use server'; | ||
|
||
import provinces from '@/utils/province.json'; | ||
import cities from '@/utils/city.json'; | ||
import counties from '@/utils/county.json'; | ||
import towns from '@/utils/town.json'; | ||
|
||
export async function getProvince(): Promise<{ name: string; id: string }[]> { | ||
return provinces; | ||
} | ||
|
||
export async function getCity( | ||
province: string | ||
): Promise<{ province: string; name: string; id: string }[]> { | ||
if (Object.getOwnPropertyNames(cities).indexOf(province) === -1) { | ||
return []; | ||
} | ||
return cities[province as keyof typeof cities]; | ||
} | ||
|
||
export async function getCounty( | ||
city: string | ||
): Promise<{ city: string; name: string; id: string }[]> { | ||
if (Object.getOwnPropertyNames(counties).indexOf(city) === -1) { | ||
return []; | ||
} | ||
return counties[city as keyof typeof counties]; | ||
} | ||
|
||
export async function getTown( | ||
county: string | ||
): Promise<{ city: string; name: string; id: string }[]> { | ||
if (Object.getOwnPropertyNames(towns).indexOf(county) === -1) { | ||
return []; | ||
} | ||
return towns[county as keyof typeof towns]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.