Skip to content

Commit

Permalink
Added apiDelete method
Browse files Browse the repository at this point in the history
  • Loading branch information
MatsAnd committed Dec 6, 2020
1 parent 5e2cbff commit 38e7289
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 38e7289

Please sign in to comment.