@nhost/nhost-js
Advanced tools
Comparing version 0.0.1-4 to 0.0.1-5
@@ -0,1 +1,6 @@ | ||
declare type ChangePasswordOptions = { | ||
oldPassword?: string; | ||
ticket?: string; | ||
newPassword: string; | ||
}; | ||
import * as types from "./types"; | ||
@@ -38,2 +43,10 @@ import UserSession from "./user-session"; | ||
}>; | ||
changePassword(options: ChangePasswordOptions): Promise<import("axios").AxiosResponse<any>>; | ||
verifyEmail(options: { | ||
ticket: string; | ||
email: string; | ||
}): Promise<any>; | ||
passwordReset({ email }: { | ||
email: string; | ||
}): Promise<import("axios").AxiosResponse<any>>; | ||
onTokenChanged(fn: Function): Function; | ||
@@ -57,1 +70,2 @@ onAuthStateChanged(fn: AuthChangedFunction): Function; | ||
} | ||
export {}; |
@@ -212,2 +212,40 @@ "use strict"; | ||
}; | ||
Auth.prototype.changePassword = function (options) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.httpClient.post("/user/password", options, { | ||
headers: { | ||
Authorization: "Bearer " + this.getJWTToken(), | ||
}, | ||
})]; | ||
case 1: return [2 /*return*/, _a.sent()]; | ||
} | ||
}); | ||
}); | ||
}; | ||
Auth.prototype.verifyEmail = function (options) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var res; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.httpClient.post("/user/email/verify", options)]; | ||
case 1: | ||
res = _a.sent(); | ||
return [2 /*return*/, res.data]; | ||
} | ||
}); | ||
}); | ||
}; | ||
Auth.prototype.passwordReset = function (_a) { | ||
var email = _a.email; | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: return [4 /*yield*/, this.httpClient.post("/user/password/reset", { email: email })]; | ||
case 1: return [2 /*return*/, _b.sent()]; | ||
} | ||
}); | ||
}); | ||
}; | ||
Auth.prototype.onTokenChanged = function (fn) { | ||
@@ -214,0 +252,0 @@ var _this = this; |
import NhostAuth from "./nhost-auth"; | ||
import NhostStorage from "./nhost-storage"; | ||
import * as types from "./types"; | ||
@@ -11,3 +12,4 @@ export default class NhostClient { | ||
auth: NhostAuth; | ||
storage: NhostStorage; | ||
constructor(config: types.NhostConfig); | ||
} |
@@ -7,2 +7,3 @@ "use strict"; | ||
var nhost_auth_1 = __importDefault(require("./nhost-auth")); | ||
var nhost_storage_1 = __importDefault(require("./nhost-storage")); | ||
var user_session_1 = __importDefault(require("./user-session")); | ||
@@ -31,2 +32,6 @@ var NhostClient = /** @class */ (function () { | ||
}, this.session); | ||
this.storage = new nhost_storage_1.default({ | ||
baseURL: this.baseURL, | ||
userSession: this.session, | ||
}); | ||
} | ||
@@ -33,0 +38,0 @@ return NhostClient; |
{ | ||
"name": "@nhost/nhost-js", | ||
"version": "0.0.1-4", | ||
"version": "0.0.1-5", | ||
"description": "Nhost JavaScript SDK", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
63393
20
1054