Skip to content

Commit 60d2ba9

Browse files
committed
Updated sample code.
1 parent b2923f9 commit 60d2ba9

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

src/components/app.jsx

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -337,16 +337,23 @@ export default class App extends Component {
337337
d.getMinutes(),
338338
html: '',
339339
css: '/* Prefix your CSS rules with `#diagram` */',
340-
js: `// Sample! Decare the participants (optional)
341-
BookService BookRepository Receipt Notification
342-
@Starter(User)
343-
"{id, dueDate, ...}" = BookService.Borrow(id) {
344-
BookRepository.Update(id, onLoan)
345-
346-
// Send Event with "Source->Target:Event". "Source->" is optional
347-
Notification:BOOK_ON_LOAN event with id, due date, etc.
348-
=="Create a Receipt"==
349-
new Receipt(id, dueDate)
340+
js: `// An example for a RESTful endpoint<br>
341+
// Go to the "Cheat sheet" tab or https://docs.zenuml.com
342+
// to find all syntax<br>
343+
// \`POST /v1/book/{id}/borrow\`
344+
BookLibService.Borrow(id) {
345+
User = Session.GetUser()
346+
if(User.isActive) {
347+
try {
348+
BookRepository.Update(id, onLoan, User)
349+
receipt = new Receipt(id, dueDate)
350+
} catch (BookNotFoundException) {
351+
ErrorService.onException(BookNotFoundException)
352+
} finally {
353+
Connection.close()
354+
}
355+
}
356+
return receipt
350357
}`,
351358
externalLibs: { js: '', css: '' },
352359
layoutMode: this.state.currentLayoutMode

0 commit comments

Comments
 (0)