File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 7777 pointer-events : none;
7878}
7979
80- .setup div {
80+ .setup . field {
8181 display : flex;
8282 flex-direction : row;
8383 align-items : center;
Original file line number Diff line number Diff line change @@ -29,18 +29,36 @@ export function SelectDataSource({
2929
3030 setIsLoading ( true )
3131
32- getDataSource ( jobBoardName , selectedDataSourceId )
33- . then ( dataSource => {
34- onSelectDataSource ( dataSource )
35- onSelectJobBoardName ( jobBoardName )
32+ // support job board URL
33+ const parsedJobBoardName = jobBoardName . replace ( "https://jobs.ashbyhq.com/" , "" )
34+
35+ // check if the job board name is valid
36+ fetch ( `https://api.ashbyhq.com/posting-api/job-board/${ parsedJobBoardName } ` )
37+ . then ( e => {
38+ if ( e . status !== 200 ) {
39+ throw new Error ( "Invalid job board name" )
40+ }
41+
42+ getDataSource ( parsedJobBoardName , selectedDataSourceId )
43+ . then ( dataSource => {
44+ onSelectDataSource ( dataSource )
45+ onSelectJobBoardName ( parsedJobBoardName )
46+ } )
47+ . catch ( ( error : unknown ) => {
48+ console . error ( error )
49+ framer . notify ( error instanceof Error ? error . message : "An unknown error occurred" , {
50+ variant : "error" ,
51+ } )
52+ } )
53+ . finally ( ( ) => {
54+ setIsLoading ( false )
55+ } )
3656 } )
3757 . catch ( ( error : unknown ) => {
3858 console . error ( error )
3959 framer . notify ( error instanceof Error ? error . message : "An unknown error occurred" , {
4060 variant : "error" ,
4161 } )
42- } )
43- . finally ( ( ) => {
4462 setIsLoading ( false )
4563 } )
4664 } ,
@@ -54,7 +72,7 @@ export function SelectDataSource({
5472 < img src = { hero } alt = "Ashby Hero" />
5573
5674 < form onSubmit = { handleSubmit } >
57- < div >
75+ < div className = "field" >
5876 < p > Job Board Name</ p >
5977 < input
6078 id = "jobBoardName"
You can’t perform that action at this time.
0 commit comments