Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/module app/appsettings/getter #2577

Merged
merged 13 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: update changeset and code comments
  • Loading branch information
eikeland authored and odinr committed Dec 2, 2024
commit 46b41805f7cef3094e88121eb7f915b6d7e0a018
1 change: 0 additions & 1 deletion .changeset/large-beds-jog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

1. **AppClient.ts**
- Added `updateAppSettings` method to set app settings by appKey.
- Initialized `#setSettings` query in the constructor.

2. **AppModuleProvider.ts**
- Added `updateAppSettings` method to update app settings.
Expand Down
10 changes: 7 additions & 3 deletions packages/modules/app/src/AppClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export class AppClient implements IAppClient {
selector: async (res: Response) => {
/** Return empyt settings if app is not registerred */
if (res.status === 404) {
return {}
return {};
}
const body = await res.json();
return body;
Expand Down Expand Up @@ -137,8 +137,12 @@ export class AppClient implements IAppClient {

this.#settings = new Query<AppSettings, { appKey: string; settings?: AppSettings }>({
client: {
fn: ({ appKey, settings }) => {;
const update = settings ? {method: 'PUT', body: JSON.stringify(settings)} : {};
fn: ({ appKey, settings }) => {
// is settings construct a push request
const update = settings
? { method: 'PUT', body: JSON.stringify(settings) }
: {};

return client.json(`/persons/me/apps/${appKey}/settings`, {
headers: {
'Api-Version': '1.0',
Expand Down