Skip to content

Commit

Permalink
Remove advanced example (#7174)
Browse files Browse the repository at this point in the history
Fixes #7112
  • Loading branch information
rijkvanzanten committed Aug 3, 2021
1 parent c6aa8bd commit ee9b7d9
Showing 1 changed file with 0 additions and 33 deletions.
33 changes: 0 additions & 33 deletions docs/reference/sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,39 +103,6 @@ Defaults to an instance of `AxiosTransport`.
const directus = new Directus('http://api.example.com/');
```

### Advanced Example

```js
//
// WARNING: OK, not exactly a warning, but this isn't needed at all.
// It's just to illustrate how the SDK is instantiated by default when
// passing only the URL as the first parameter.
//

const url = 'http://api.example.com/';

const isBrowser = typeof window !== 'undefined';

// Storage adapter where authentication state (token & expiration) is stored.
const storage = isBrowser ? new LocalStorage() : new MemoryStorage();

// Transport used to communicate with the server.
const transport = new AxiosTransport(url, storage, async () => {
await auth.refresh(); // This is how axios checks for refresh
});

// Auth is how authentication is handled, stored, and refreshed.
const auth = new Auth(transport, storage, {
mode: isBrowser ? 'cookie' : 'json',
});

const directus = new Directus(url, {
auth,
storage,
transport,
});
```

### Get / Set API URL

```js
Expand Down

0 comments on commit ee9b7d9

Please sign in to comment.