Skip to content

Commit

Permalink
features/support-return-promise-request-config (#93)
Browse files Browse the repository at this point in the history
* Supported promise return on request functions

* Updated demo page for addresses

* Updated README.md to support promise on request functions
  • Loading branch information
michaeljymsgutierrez authored Aug 9, 2024
1 parent ca1d3af commit fc5b9a8
Show file tree
Hide file tree
Showing 5 changed files with 265 additions and 212 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,15 @@ import { ARM } from 'path-to-src/index.js'
// Can be used anywhere in your application through ARM.getAlias('customerAddress')
alias: 'customerAddress' ,
// Auto resolve serve as flag if the request functions will return
// 1. Promise Function
// - To handle success and errors on manual resolve) if autoResolve is set to false
// 2. Observable/Reactive Data
// - To handle success and errors on auto resolve) if autoResolve is set to true
// Note: autoResolve is only available on query, queryRecord, findAll, findRecord functions.
// By default autoResolve is set to true.
autoResolve: false,
// Override serve as request override for the default configuration of axios current request.
// Currently support host, namespace, path and headers for the meantime.
// Example:
Expand Down
11 changes: 11 additions & 0 deletions next-app/src/app/addresses/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,17 @@ const AddressesListPage = observer(() => {
})}
</tbody>
</table>
{/* <button */}
{/* onClick={() => { */}
{/* ARM.findRecord('addresses', 2487520, {}, { autoResolve: false }).then( */}
{/* (results) => { */}
{/* console.log(results) */}
{/* } */}
{/* ) */}
{/* }} */}
{/* > */}
{/* FIND */}
{/* </button> */}
</div>
)
})
Expand Down
Loading

0 comments on commit fc5b9a8

Please sign in to comment.