roboto-js 1.4.5 → 1.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +131 -112
- package/dist/cjs/rbt_api.cjs +292 -244
- package/dist/esm/index.js +3 -0
- package/dist/esm/rbt_api.js +21 -1
- package/package.json +1 -1
- package/src/index.js +3 -0
- package/src/rbt_api.js +30 -1
package/dist/esm/index.js
CHANGED
package/dist/esm/rbt_api.js
CHANGED
|
@@ -88,7 +88,27 @@ export default class RbtApi {
|
|
|
88
88
|
if (this.localStorageAdaptor) {
|
|
89
89
|
await this.localStorageAdaptor.setItem('authtoken', response.data.authToken);
|
|
90
90
|
}
|
|
91
|
-
return
|
|
91
|
+
return response.data;
|
|
92
|
+
} catch (e) {
|
|
93
|
+
this._handleError(e);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
async loginWithOauth(userData) {
|
|
97
|
+
try {
|
|
98
|
+
debugger;
|
|
99
|
+
const response = await this.post('/registerOrSigninOauth', userData);
|
|
100
|
+
if (response.data.ok === false) {
|
|
101
|
+
return this._handleError(response);
|
|
102
|
+
}
|
|
103
|
+
this.iac_session = response.data;
|
|
104
|
+
this.currentUser = this.iac_session ? new RbtUser(this.iac_session.user, this.axios) : null;
|
|
105
|
+
// update axios instance headers with authtoken
|
|
106
|
+
this.axios.defaults.headers.common['authtoken'] = response.data.authToken;
|
|
107
|
+
this.authtoken = response.data.authToken;
|
|
108
|
+
if (this.localStorageAdaptor) {
|
|
109
|
+
await this.localStorageAdaptor.setItem('authtoken', response.data.authToken);
|
|
110
|
+
}
|
|
111
|
+
return response.data;
|
|
92
112
|
} catch (e) {
|
|
93
113
|
this._handleError(e);
|
|
94
114
|
}
|
package/package.json
CHANGED
package/src/index.js
CHANGED
package/src/rbt_api.js
CHANGED
|
@@ -103,12 +103,41 @@ export default class RbtApi {
|
|
|
103
103
|
await this.localStorageAdaptor.setItem('authtoken', response.data.authToken);
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
return
|
|
106
|
+
return response.data;
|
|
107
|
+
|
|
108
|
+
} catch (e) {
|
|
109
|
+
|
|
110
|
+
this._handleError(e);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
107
113
|
|
|
114
|
+
async loginWithOauth(userData){
|
|
115
|
+
|
|
116
|
+
try {
|
|
117
|
+
debugger;
|
|
118
|
+
const response = await this.post('/registerOrSigninOauth', userData );
|
|
119
|
+
|
|
120
|
+
if (response.data.ok === false) {
|
|
121
|
+
return this._handleError(response);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
this.iac_session = response.data;
|
|
125
|
+
this.currentUser = (this.iac_session)? new RbtUser(this.iac_session.user, this.axios): null;
|
|
126
|
+
// update axios instance headers with authtoken
|
|
127
|
+
this.axios.defaults.headers.common['authtoken'] = response.data.authToken;
|
|
128
|
+
this.authtoken = response.data.authToken;
|
|
129
|
+
|
|
130
|
+
if(this.localStorageAdaptor){
|
|
131
|
+
await this.localStorageAdaptor.setItem('authtoken', response.data.authToken);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return response.data;
|
|
135
|
+
|
|
108
136
|
} catch (e) {
|
|
109
137
|
|
|
110
138
|
this._handleError(e);
|
|
111
139
|
}
|
|
140
|
+
|
|
112
141
|
}
|
|
113
142
|
|
|
114
143
|
async logout() {
|