@@ -32,19 +32,28 @@ export default {
3232} )
3333. catch ( error => {
3434onError ( error )
35- console . error ( 'ERROR: Authentication failed' )
36- console . error ( error )
35+ console . log ( 'ERROR: Authentication failed' )
36+ console . log ( error . message )
37+ let message
38+ if ( error . message . match ( / N e t w o r k e r r o r : / ) ) {
39+ message = {
40+ title :'Network Error' ,
41+ description :'Make sure you have an Internet connection. Restart and try again' ,
42+ }
43+ } else {
44+ message = {
45+ title :'Server Error' ,
46+ description :error . message ,
47+ }
48+ }
49+ channel . receive ( { data :{ type :'ERROR' , payload :{ error :message } } } )
50+ return
3751} )
3852
3953if ( ! result || ! result . data ) {
40- // TODO handle failed authentication
41- console . error ( 'ERROR: Connection' )
42- const error = {
43- title :'Connection Failed' ,
44- description :
45- 'Either our server is having issues or you may not be connected to the internet. Try checking your connection and restarting the application. ' ,
46- }
47- channel . receive ( { data :{ type :'ERROR' , payload :{ error} } } )
54+ const error = new Error ( 'Authentication request responded with no data' )
55+ console . log ( error )
56+ onError ( error )
4857return
4958}
5059const { token} = result . data . editorLogin