File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed
Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -7,8 +7,12 @@ Simple, typed wrapper of an Axios instance for Nextcloud that automatically send
77
88## Installation
99
10+ ``` sh
11+ npm install @nextcloud/axios --save
1012```
11- npm i -S @nextcloud/axios
13+
14+ ``` sh
15+ yarn add @nextcloud/axios
1216```
1317
1418## Usage
@@ -20,3 +24,21 @@ axios.get('nextcloud.com')
2024```
2125
2226See https://github.com/axios/axios for details.
27+
28+ ### Defining ` baseURL `
29+
30+ You are able to define [ ` baseURL ` ] ( https://axios-http.com/docs/config_defaults ) to simplify the usage of axios across your app.
31+
32+ ``` ts
33+ import axios from ' @nextcloud/axios'
34+ import { generateUrl } from ' @nextcloud/router'
35+
36+ const baseURL = generateUrl (' /apps/your_app_id/api' )
37+
38+ axios .defaults .baseURL = baseURL
39+ ```
40+
41+ References
42+
43+ - [ @nextcloud/router ] ( https://github.com/nextcloud/nextcloud-router )
44+ - [ Nextcloud App Routing] ( https://docs.nextcloud.com/server/latest/developer_manual/basics/routing.html )
You can’t perform that action at this time.
0 commit comments