-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from AkshataKatwal16/admin
Issue feat: #PS-1301 Integrate state district block list api
- Loading branch information
Showing
4 changed files
with
123 additions
and
17 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 @@ | ||
import { get } from "./RestClient"; | ||
export const getStateList = async ( | ||
|
||
): Promise<any> => { | ||
const apiUrl: string = `${process.env.NEXT_PUBLIC_BASE_URL}/fields/options/read/states?context=USERS`; | ||
try { | ||
const response = await get(apiUrl); | ||
return response?.data; | ||
} catch (error) { | ||
console.error('error in fetching user details', error); | ||
return error; | ||
} | ||
}; | ||
|
||
|
||
export const getDistrictList = async ( state: string | string[]): Promise<any> => { | ||
const apiUrl: string = `${process.env.NEXT_PUBLIC_BASE_URL}/fields/options/read/districts?controllingfieldfk=${state}&context=USERS`; | ||
try { | ||
const response = await get(apiUrl); | ||
return response?.data; | ||
} catch (error) { | ||
console.error('error in fetching user details', error); | ||
return error; | ||
} | ||
}; | ||
|
||
|
||
export const getBlockList = async (district: string | string[]): Promise<any> => { | ||
const apiUrl: string = `${process.env.NEXT_PUBLIC_BASE_URL}/fields/options/read/blocks?controllingfieldfk=${district}&context=USERS`; | ||
try { | ||
const response = await get(apiUrl); | ||
return response?.data; | ||
} catch (error) { | ||
console.error('error in fetching user details', error); | ||
return error; | ||
} | ||
}; |
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