Skip to content

Commit

Permalink
Merge pull request #14 from vtfk/delete
Browse files Browse the repository at this point in the history
Add apiDelete
  • Loading branch information
MatsAnd authored Dec 6, 2020
2 parents 5e2cbff + 38e7289 commit a7d5d0c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,12 @@ const App = () => {
<li>url (string) <i>(required)</i></li>
<li>data <i>(required)</i></ul>
</details>

- `apiDelete` (function) - deletes data from provided URL using the users id_token
<details>
<summary>Parameters</summary>
<ul>
<li>url (string) <i>(required)</i></li>
</details>

#### User object

Expand Down
4 changes: 3 additions & 1 deletion src/lib/auth-provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ export const MsalProvider = ({
const apiGet = url => retry(() => axios.get(url))
const apiPost = (url, payload) => retry(() => axios.post(url, payload))
const apiPut = (url, payload) => retry(() => axios.put(url, payload))
const apiDelete = url => retry(() => axios.delete(url))

return (
<MsalContext.Provider
Expand All @@ -274,7 +275,8 @@ export const MsalProvider = ({
getToken,
apiGet,
apiPost,
apiPut
apiPut,
apiDelete
}}
>
{children}
Expand Down

0 comments on commit a7d5d0c

Please sign in to comment.