@quoll/client-lib
Advanced tools
Comparing version 0.4.15 to 0.5.0
@@ -6,2 +6,12 @@ # Change Log | ||
# [0.5.0](https://github.com/mzogheib/quoll/compare/@quoll/client-lib@0.4.15...@quoll/client-lib@0.5.0) (2024-07-11) | ||
### Bug Fixes | ||
- **client-lib:** handle errors when deauthorizing feeds ([cf455c0](https://github.com/mzogheib/quoll/commit/cf455c0f95c20107d309652b4fc4a4b3fb37b01b)) | ||
### Features | ||
- update Toshl connection method ([#226](https://github.com/mzogheib/quoll/issues/226)) ([a2effdd](https://github.com/mzogheib/quoll/commit/a2effdd296895371f56c730f3da665bb6f7ef783)) | ||
## [0.4.15](https://github.com/mzogheib/quoll/compare/@quoll/client-lib@0.4.14...@quoll/client-lib@0.4.15) (2024-07-07) | ||
@@ -8,0 +18,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { FeedName } from "@quoll/lib"; | ||
import { FeedConnectionConfig, FeedName } from "@quoll/lib"; | ||
import { Store } from "../../../store"; | ||
@@ -13,3 +13,3 @@ import { FeedsService } from "../service"; | ||
isOneConnected: boolean; | ||
connect: (name: FeedName) => Promise<string>; | ||
connect: (name: FeedName) => Promise<FeedConnectionConfig>; | ||
disconnect: (name: FeedName) => Promise<void>; | ||
@@ -16,0 +16,0 @@ authenticate: (name: FeedName, code: string) => Promise<void>; |
@@ -26,10 +26,16 @@ "use strict"; | ||
updateFeed(name, { isAuthenticating: true }); | ||
const url = yield feedsService.getOauthUrl(name); | ||
const config = yield feedsService.connect(name); | ||
updateFeed(name, { isAuthenticating: false }); | ||
return url; | ||
return config; | ||
}), [updateFeed]); | ||
const disconnect = (0, react_1.useCallback)((name) => __awaiter(void 0, void 0, void 0, function* () { | ||
updateFeed(name, { isAuthenticating: true }); | ||
yield feedsService.deauthorize(name); | ||
updateFeed(name, { isConnected: false, isAuthenticating: false }); | ||
try { | ||
updateFeed(name, { isAuthenticating: true }); | ||
yield feedsService.deauthorize(name); | ||
updateFeed(name, { isConnected: false, isAuthenticating: false }); | ||
} | ||
catch (error) { | ||
updateFeed(name, { isConnected: true, isAuthenticating: false }); | ||
throw error; | ||
} | ||
}), [updateFeed]); | ||
@@ -36,0 +42,0 @@ const authenticate = (0, react_1.useCallback)((name, code) => __awaiter(void 0, void 0, void 0, function* () { |
@@ -1,2 +0,2 @@ | ||
import { FeedName } from "@quoll/lib"; | ||
import { FeedConnectionConfig, FeedName } from "@quoll/lib"; | ||
import { AuthenticatedApiService } from "../../../utils"; | ||
@@ -7,3 +7,3 @@ type AuthenticatePayload = { | ||
export declare class FeedsService extends AuthenticatedApiService { | ||
getOauthUrl(feed: FeedName): Promise<string>; | ||
connect(feed: FeedName): Promise<FeedConnectionConfig>; | ||
authenticate(feed: FeedName, payload: AuthenticatePayload): Promise<null>; | ||
@@ -10,0 +10,0 @@ deauthorize(feed: FeedName): Promise<null>; |
@@ -16,3 +16,3 @@ "use strict"; | ||
class FeedsService extends utils_1.AuthenticatedApiService { | ||
getOauthUrl(feed) { | ||
connect(feed) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -19,0 +19,0 @@ return this.request({ |
{ | ||
"name": "@quoll/client-lib", | ||
"version": "0.4.15", | ||
"version": "0.5.0", | ||
"description": "Shared code for client side packages", | ||
@@ -18,3 +18,3 @@ "repository": "https://github.com/mzogheib/quoll", | ||
"dependencies": { | ||
"@quoll/lib": "^0.4.9", | ||
"@quoll/lib": "^0.5.0", | ||
"react-redux": "^7.2.1", | ||
@@ -32,3 +32,3 @@ "redux": "^4.0.5" | ||
}, | ||
"gitHead": "92044fd41149c15925bf7b93645d06d83846637d" | ||
"gitHead": "6ceb13c436510b51608d4f049dee7cb612078e28" | ||
} |
import { useMemo, useCallback } from "react"; | ||
import { FeedName } from "@quoll/lib"; | ||
import { FeedConnectionConfig, FeedName } from "@quoll/lib"; | ||
@@ -18,3 +18,3 @@ import { Store } from "../../../store"; | ||
isOneConnected: boolean; | ||
connect: (name: FeedName) => Promise<string>; | ||
connect: (name: FeedName) => Promise<FeedConnectionConfig>; | ||
disconnect: (name: FeedName) => Promise<void>; | ||
@@ -58,6 +58,6 @@ authenticate: (name: FeedName, code: string) => Promise<void>; | ||
updateFeed(name, { isAuthenticating: true }); | ||
const url = await feedsService.getOauthUrl(name); | ||
const config = await feedsService.connect(name); | ||
updateFeed(name, { isAuthenticating: false }); | ||
return url; | ||
return config; | ||
}, | ||
@@ -69,5 +69,10 @@ [updateFeed], | ||
async (name: FeedName) => { | ||
updateFeed(name, { isAuthenticating: true }); | ||
await feedsService.deauthorize(name); | ||
updateFeed(name, { isConnected: false, isAuthenticating: false }); | ||
try { | ||
updateFeed(name, { isAuthenticating: true }); | ||
await feedsService.deauthorize(name); | ||
updateFeed(name, { isConnected: false, isAuthenticating: false }); | ||
} catch (error) { | ||
updateFeed(name, { isConnected: true, isAuthenticating: false }); | ||
throw error; | ||
} | ||
}, | ||
@@ -74,0 +79,0 @@ [updateFeed], |
@@ -1,2 +0,2 @@ | ||
import { FeedName } from "@quoll/lib"; | ||
import { FeedConnectionConfig, FeedName } from "@quoll/lib"; | ||
import { AuthenticatedApiService } from "../../../utils"; | ||
@@ -11,4 +11,4 @@ | ||
export class FeedsService extends AuthenticatedApiService { | ||
async getOauthUrl(feed: FeedName) { | ||
return this.request<string>({ | ||
async connect(feed: FeedName) { | ||
return this.request<FeedConnectionConfig>({ | ||
method: "GET", | ||
@@ -15,0 +15,0 @@ endpoint, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
93159
1439
+ Added@quoll/lib@0.5.7(transitive)
- Removed@quoll/lib@0.4.9(transitive)
Updated@quoll/lib@^0.5.0