mirror of
https://github.com/mosip/inji-wallet.git
synced 2026-01-09 13:38:01 -05:00
feat(#162): [Tilak|Pooja] Update app id when settings context is present in db but not app id
This commit is contained in:
@@ -60,6 +60,11 @@ export const settingsMachine = model.createMachine(
|
||||
entry: ['requestStoredContext'],
|
||||
on: {
|
||||
STORE_RESPONSE: [
|
||||
{
|
||||
cond: 'hasPartialData',
|
||||
target: 'idle',
|
||||
actions: ['setContext', 'updatePartialDefaults', 'storeContext'],
|
||||
},
|
||||
{ cond: 'hasData', target: 'idle', actions: ['setContext'] },
|
||||
{ target: 'storingDefaults' },
|
||||
],
|
||||
@@ -116,6 +121,10 @@ export const settingsMachine = model.createMachine(
|
||||
appId: generateAppId(),
|
||||
}),
|
||||
|
||||
updatePartialDefaults: model.assign({
|
||||
appId: (context) => context.appId || generateAppId(),
|
||||
}),
|
||||
|
||||
storeContext: send(
|
||||
(context) => {
|
||||
const { serviceRefs, ...data } = context;
|
||||
@@ -180,6 +189,8 @@ export const settingsMachine = model.createMachine(
|
||||
|
||||
guards: {
|
||||
hasData: (_, event) => event.response != null,
|
||||
hasPartialData: (_, event) =>
|
||||
event.response != null && event.response.appId == null,
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user