Josh 22f3123e94
refactor(admin): add auth provider & move to use redux-toolkit-query (#19062)
* feat(admin): add Auth feature

* refactor: authentication to use redux-toolkit

* chore(admin): convert admin data-fetching to use redux-toolkit-query

* chore: add docs

* fix: default logo would not show on login page

* fix: app flashes on logout

* fix: logout should work across browsers
2024-01-02 17:01:58 +00:00

110 lines
2.0 KiB
TypeScript

import { errors } from '@strapi/utils';
import { Entity } from '@strapi/types';
export type ApiToken = {
accessKey: string;
createdAt: string;
description: string;
expiresAt: string;
id: Entity.ID;
lastUsedAt: string | null;
lifespan: string | number;
name: string;
permissions: string[];
type: 'custom' | 'full-access' | 'read-only';
updatedAt: string;
};
export interface ApiTokenBody extends Pick<ApiToken, 'description' | 'name'> {
lifespan?: ApiToken['lifespan'] | null;
permissions?: ApiToken['permissions'] | null;
type: ApiToken['type'] | undefined;
}
/**
* POST /api-tokens - Create an api token
*/
export declare namespace Create {
export interface Request {
body: ApiTokenBody;
query: {};
}
export interface Response {
data: ApiToken;
error?: errors.ApplicationError | errors.YupValidationError;
}
}
/**
* GET /api-tokens - List api tokens
*/
export declare namespace List {
export interface Request {
body: {};
query: {};
}
export interface Response {
data: ApiToken[];
error?: errors.ApplicationError;
}
}
/**
* DELETE /api-tokens/:id - Delete an API token
*/
export declare namespace Revoke {
export interface Request {
body: {};
query: {};
}
export interface Params {
id: Entity.ID;
}
export interface Response {
data: ApiToken;
error?: errors.ApplicationError;
}
}
/**
* GET /api-tokens/:id - Get an API token
*/
export declare namespace Get {
export interface Request {
body: {};
query: {};
}
export interface Params {
id: Entity.ID;
}
export interface Response {
data: ApiToken;
error?: errors.ApplicationError;
}
}
/**
* POST /api-tokens/:id - Update an API token
*/
export declare namespace Update {
export interface Request {
body: ApiTokenBody;
query: {};
}
export interface Params {
id: Entity.ID;
}
export interface Response {
data: ApiToken;
error?: errors.ApplicationError | errors.YupValidationError;
}
}