import SDK from '@directus/sdk-js';
const sdk = new SDK({
url: 'https://my-directus.com',
token: 'my-token-comes-here'
});
import SDK from '@directus/sdk-js';
const sdk = new SDK({
url: 'https://my-directus.com',
email: '[email protected]',
password: 'my-password'
});
import SDK from '@directus/sdk-js';
const sdk = new SDK({
url: 'https://my-directus.com',
token: 'my-token-comes-here'
});
sdk.logout();
It is possible to modify the shared configuration during the runtime of your program.
To do so just edit the SDK.config
fields, which will change the setting for your SDK instance.
import SDK, { Configuration } from '@directus/sdk-js';
Configuration.defaults = {
project: "default-project",
tokenExpirationTime: 10 * 6 * 1000; // 10s instead of 5s
};
const sdk1 = new SDK({ url: 'https://my-directus.com' });
const sdk2 = new SDK({ url: 'https://my-directus.com' });