Skip to content

Commit

Permalink
Make Send request content persist, for Pro users only
Browse files Browse the repository at this point in the history
  • Loading branch information
pimterry committed Mar 15, 2024
1 parent cd5a81f commit 3c44544
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const rulesStore = new RulesStore(accountStore, proxyStore,
}
);
const eventsStore = new EventsStore(proxyStore, apiStore, rulesStore);
const sendStore = new SendStore(eventsStore, rulesStore);
const sendStore = new SendStore(accountStore, eventsStore, rulesStore);

const stores = {
accountStore,
Expand Down
14 changes: 10 additions & 4 deletions src/model/send/send-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { trackEvent } from '../../metrics';

import { EventsStore } from '../events/events-store';
import { RulesStore } from '../rules/rules-store';
import { AccountStore } from '../account/account-store';
import * as ServerApi from '../../services/server-api';

import { HttpExchange } from '../http/exchange';
Expand All @@ -33,20 +34,25 @@ import {
export class SendStore {

constructor(
private accountStore: AccountStore,
private eventStore: EventsStore,
private rulesStore: RulesStore
) {}

readonly initialized = lazyObservablePromise(async () => {
await Promise.all([
this.accountStore.initialized,
this.eventStore.initialized,
this.rulesStore.initialized
]);

await hydrate({
key: 'send-store',
store: this
});
if (this.accountStore.mightBePaidUser) {
// For Pro users only, your 'Send' content persists on reload
await hydrate({
key: 'send-store',
store: this
});
}

autorun(() => {
if (this.requestInputs.length === 0) this.addRequestInput();
Expand Down

0 comments on commit 3c44544

Please sign in to comment.