Skip to content

Commit

Permalink
feat(com): order storage provider refresh by user signal
Browse files Browse the repository at this point in the history
Co-authored-by: Mohammad Honarvar <honarvar.info@gmail.com>
Co-authored-by: S. Amir Mohammad Najafi <njfamirm@gmail.com>
  • Loading branch information
3 people committed Mar 19, 2023
1 parent eea2382 commit 7138ae0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions uniquely/com-pwa/src/manager/context-provider/order-storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {serverContextConsumer} from '@alwatr/context';
import {config} from '../../config.js';

import type {AlwatrDocumentStorage, User} from '@alwatr/type';
import type {Order} from '@alwatr/type/src/customer-order-management.js';
import type {Order} from '@alwatr/type/customer-order-management.js';

export const orderStorageContextConsumer = serverContextConsumer<AlwatrDocumentStorage<Order>>(
'order_storage_context',
Expand All @@ -17,8 +17,14 @@ orderStorageContextConsumer.fsm.defineSignals([
{
signalId: 'user_context',
callback: (user: User): void => {
(orderStorageContextConsumer.getOptions().queryParameters ??= {}).userId = user.id;
// (orderStorageContextConsumer.getOptions().queryParameters ??= {}).userId = user.id;
orderStorageContextConsumer.request({
queryParameters: {
userId: user.id,
},
});
},
receivePrevious: 'NextCycle',
},
{
signalId: 'reload_order_storage',
Expand Down

0 comments on commit 7138ae0

Please sign in to comment.