thau-react
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -7,3 +7,4 @@ export { default as useThau } from './hooks/useThau'; | ||
export { default as useLoginWithFacebook } from './hooks/useLoginWithFacebook'; | ||
export { default as useLoginWithGithub } from './hooks/useLoginWithGithub'; | ||
export { default as useLogout } from './hooks/useLogout'; | ||
export { default as ThauProvider } from './Provider'; |
@@ -221,2 +221,34 @@ import { createContext, useContext, useState, useReducer, useEffect, createElement } from 'react'; | ||
var useLoginWithGithub = function () { | ||
var thau = useContext(thauContext); | ||
var _a = useState(false), loading = _a[0], setLoading = _a[1]; | ||
var _b = useState(), error = _b[0], setError = _b[1]; | ||
var createUserWithGithub = function () { return __awaiter(void 0, void 0, void 0, function () { | ||
var e_1; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
setLoading(true); | ||
_a.label = 1; | ||
case 1: | ||
_a.trys.push([1, 3, , 4]); | ||
if (!thau.client) { | ||
throw new ThauError('Client is not initialized'); | ||
} | ||
return [4 /*yield*/, thau.client.loginWithGithub()]; | ||
case 2: | ||
_a.sent(); | ||
return [3 /*break*/, 4]; | ||
case 3: | ||
e_1 = _a.sent(); | ||
setLoading(false); | ||
setError(e_1); | ||
return [3 /*break*/, 4]; | ||
case 4: return [2 /*return*/]; | ||
} | ||
}); | ||
}); }; | ||
return [{ loading: loading, error: error }, createUserWithGithub]; | ||
}; | ||
var useLogout = function () { | ||
@@ -310,3 +342,3 @@ var thau = useContext(thauContext); | ||
export { ThauProvider, useCreateUserWithPassword, useLoginWithfacebook as useLoginWithFacebook, useLoginWithGoogle, useLoginWithPassword, useLogout, useSession, useThau }; | ||
export { ThauProvider, useCreateUserWithPassword, useLoginWithfacebook as useLoginWithFacebook, useLoginWithGithub, useLoginWithGoogle, useLoginWithPassword, useLogout, useSession, useThau }; | ||
//# sourceMappingURL=index.es.js.map |
@@ -225,2 +225,34 @@ 'use strict'; | ||
var useLoginWithGithub = function () { | ||
var thau = React.useContext(thauContext); | ||
var _a = React.useState(false), loading = _a[0], setLoading = _a[1]; | ||
var _b = React.useState(), error = _b[0], setError = _b[1]; | ||
var createUserWithGithub = function () { return __awaiter(void 0, void 0, void 0, function () { | ||
var e_1; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
setLoading(true); | ||
_a.label = 1; | ||
case 1: | ||
_a.trys.push([1, 3, , 4]); | ||
if (!thau.client) { | ||
throw new thauJs.ThauError('Client is not initialized'); | ||
} | ||
return [4 /*yield*/, thau.client.loginWithGithub()]; | ||
case 2: | ||
_a.sent(); | ||
return [3 /*break*/, 4]; | ||
case 3: | ||
e_1 = _a.sent(); | ||
setLoading(false); | ||
setError(e_1); | ||
return [3 /*break*/, 4]; | ||
case 4: return [2 /*return*/]; | ||
} | ||
}); | ||
}); }; | ||
return [{ loading: loading, error: error }, createUserWithGithub]; | ||
}; | ||
var useLogout = function () { | ||
@@ -317,2 +349,3 @@ var thau = React.useContext(thauContext); | ||
exports.useLoginWithFacebook = useLoginWithfacebook; | ||
exports.useLoginWithGithub = useLoginWithGithub; | ||
exports.useLoginWithGoogle = useLoginWithGoogle; | ||
@@ -319,0 +352,0 @@ exports.useLoginWithPassword = useLoginWithPassword; |
{ | ||
"name": "thau-react", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Thau React client.", | ||
@@ -25,3 +25,3 @@ "repository": "https://github.com/thau-quester/thau-react", | ||
"react": "^16.8.1", | ||
"thau-js": "^0.1.2" | ||
"thau-js": "^0.1.3" | ||
}, | ||
@@ -47,3 +47,3 @@ "devDependencies": { | ||
"rollup-plugin-typescript2": "^0.27.1", | ||
"thau-js": "^0.1.1", | ||
"thau-js": "0.1.3", | ||
"ts-jest": "^25.5.1", | ||
@@ -50,0 +50,0 @@ "tslint": "^6.1.2", |
@@ -24,3 +24,3 @@ # thau-react | ||
export default function App() { | ||
<ThauProvider thauUrl="http://localhost:9000"> | ||
<ThauProvider thauUrl="http://localhost:9000/api/v1"> | ||
... | ||
@@ -37,3 +37,4 @@ </ThauProvider> | ||
* `useLoginWithGoogle()` | ||
* `useLoginWithGithub()` | ||
* `useLoginWithPassword()` | ||
* `useLogout()` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
95921
18
745
39