@korajs/auth 0.3.0 → 0.3.2
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/index.cjs +8 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -5
- package/dist/index.js.map +1 -1
- package/dist/server.cjs +403 -3
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +208 -11
- package/dist/server.d.ts +208 -11
- package/dist/server.js +381 -0
- package/dist/server.js.map +1 -1
- package/package.json +15 -6
package/dist/index.cjs
CHANGED
|
@@ -233,8 +233,9 @@ var AuthClient = class {
|
|
|
233
233
|
method: "POST",
|
|
234
234
|
body: params
|
|
235
235
|
});
|
|
236
|
-
|
|
237
|
-
|
|
236
|
+
const tokens = "tokens" in response ? response.tokens : response;
|
|
237
|
+
this.storage.setTokens(tokens.accessToken, tokens.refreshToken);
|
|
238
|
+
const user = await this.fetchUserProfile(tokens.accessToken);
|
|
238
239
|
this.setState("authenticated", user);
|
|
239
240
|
return user;
|
|
240
241
|
}
|
|
@@ -250,8 +251,9 @@ var AuthClient = class {
|
|
|
250
251
|
method: "POST",
|
|
251
252
|
body: params
|
|
252
253
|
});
|
|
253
|
-
|
|
254
|
-
|
|
254
|
+
const tokens = "tokens" in response ? response.tokens : response;
|
|
255
|
+
this.storage.setTokens(tokens.accessToken, tokens.refreshToken);
|
|
256
|
+
const user = await this.fetchUserProfile(tokens.accessToken);
|
|
255
257
|
this.setState("authenticated", user);
|
|
256
258
|
return user;
|
|
257
259
|
}
|
|
@@ -479,7 +481,8 @@ var AuthClient = class {
|
|
|
479
481
|
{ path, status: response.status, serverError }
|
|
480
482
|
);
|
|
481
483
|
}
|
|
482
|
-
const
|
|
484
|
+
const json = await response.json();
|
|
485
|
+
const data = json["data"] !== void 0 ? json["data"] : json;
|
|
483
486
|
return data;
|
|
484
487
|
}
|
|
485
488
|
};
|