-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
49 changed files
with
1,289 additions
and
754 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
yarn workspaces run lint-staged |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
= Performing write operations | ||
|
||
This application uses React's hooks and context API to provide a "save" function which allows | ||
you to perform write operations against the back-end API. "save" accepts an array of | ||
operations to perform, so you can submit multiple resource operations in a single transaction | ||
in a single HTTP request. | ||
|
||
If one operation fails, the entire transaction is cancelled, and "save" throws an Error, | ||
which provides an aggregation message of all of the error messages. This function relies on the back-end to | ||
support JSONAPI's jsonpatch extension (implemented by crnk-operations). | ||
|
||
Here is a simple example of a component that uses the "save" function from the context to | ||
provide a button that creates a new Region with a random name and symbol: | ||
|
||
[source,tsx] | ||
---- | ||
import React from "react"; | ||
import { useApiClient } from "common-ui"; | ||
export funcion NewRegionButton() { | ||
const { save } = useApiClient(); | ||
async function createRegion() { | ||
await save( | ||
[ | ||
{ | ||
resource: { | ||
name: `new-region-${Math.random()}`, | ||
seq: "", | ||
symbol: `${Math.random()}`, | ||
type: "PRIMER" | ||
}, | ||
type: "region" | ||
} | ||
], | ||
{ apiBaseUrl: "/seqdb-api" } | ||
); | ||
}; | ||
return <button onClick={this.createRegion}>Create Region</button>; | ||
} | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.