Rewrite these default callbacks as alertresponse.
This commit is contained in:
		
							parent
							
								
									bf9223bf67
								
							
						
					
					
						commit
						0a31dad196
					
				
					 1 changed files with 17 additions and 25 deletions
				
			
		|  | @ -103,28 +103,24 @@ function remove_photos(album_id, photo_ids, callback) | ||||||
| api.albums.callback_follow = | api.albums.callback_follow = | ||||||
| function callback_follow(response) | function callback_follow(response) | ||||||
| { | { | ||||||
|     if (response["meta"]["status"] == 200 && response["data"]["id"]) |     if ((response.meta.status !== 200) || (! response.json_ok) || (! response.data.id)) | ||||||
|     { |     { | ||||||
|         window.location.href = "/album/" + response["data"]["id"]; |         alert(JSON.stringify(response)); | ||||||
|     } |         return; | ||||||
|     else |  | ||||||
|     { |  | ||||||
|         console.log(response); |  | ||||||
|     } |     } | ||||||
|  |     window.location.href = "/album/" + response.data.id; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| api.albums.callback_go_to_albums = | api.albums.callback_go_to_albums = | ||||||
| function callback_go_to_albums(response) | function callback_go_to_albums(response) | ||||||
| { | { | ||||||
|     if (response["meta"]["status"] == 200) |     if (response.meta.status !== 200) | ||||||
|     { |     { | ||||||
|  |         alert(JSON.stringify(response)); | ||||||
|  |         return; | ||||||
|  |     } | ||||||
|     window.location.href = "/albums"; |     window.location.href = "/albums"; | ||||||
| } | } | ||||||
|     else |  | ||||||
|     { |  | ||||||
|         console.log(response); |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| 
 | 
 | ||||||
| /**************************************************************************************************/ | /**************************************************************************************************/ | ||||||
| api.bookmarks = {}; | api.bookmarks = {}; | ||||||
|  | @ -294,17 +290,15 @@ function unset_searchhidden(photo_id, callback) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| api.photos.callback_go_to_search = | api.photos.callback_go_to_search = | ||||||
| function callback_go_to_albums(response) | function callback_go_to_search(response) | ||||||
| { | { | ||||||
|     if (response["meta"]["status"] == 200) |     if (response.meta.status !== 200) | ||||||
|     { |     { | ||||||
|  |         alert(JSON.stringify(response)); | ||||||
|  |         return; | ||||||
|  |     } | ||||||
|     window.location.href = "/search"; |     window.location.href = "/search"; | ||||||
| } | } | ||||||
|     else |  | ||||||
|     { |  | ||||||
|         console.log(response); |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| 
 | 
 | ||||||
| /**************************************************************************************************/ | /**************************************************************************************************/ | ||||||
| api.tags = {}; | api.tags = {}; | ||||||
|  | @ -382,15 +376,13 @@ function remove_synonym(tag_name, syn_name, callback) | ||||||
| api.tags.callback_go_to_tags = | api.tags.callback_go_to_tags = | ||||||
| function callback_go_to_tags(response) | function callback_go_to_tags(response) | ||||||
| { | { | ||||||
|     if (response["meta"]["status"] == 200) |     if (response.meta.status !== 200) | ||||||
|     { |     { | ||||||
|  |         alert(JSON.stringify(response)); | ||||||
|  |         return; | ||||||
|  |     } | ||||||
|     window.location.href = "/tags"; |     window.location.href = "/tags"; | ||||||
| } | } | ||||||
|     else |  | ||||||
|     { |  | ||||||
|         console.log(response); |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| 
 | 
 | ||||||
| /**************************************************************************************************/ | /**************************************************************************************************/ | ||||||
| api.users = {}; | api.users = {}; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue