mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-10 13:38:49 +08:00
feat: login token state
This commit is contained in:
@@ -1,37 +1,5 @@
|
||||
import { request } from '../request';
|
||||
|
||||
export interface ExchangeToken {
|
||||
type: 'Google';
|
||||
/**
|
||||
* Token from firebase.
|
||||
*/
|
||||
token: string;
|
||||
}
|
||||
|
||||
export interface RefreshToken {
|
||||
type: 'Refresh';
|
||||
token: string;
|
||||
}
|
||||
|
||||
export type LoginParams = ExchangeToken | RefreshToken;
|
||||
|
||||
export interface LoginResponse {
|
||||
/**
|
||||
* JWT, expires in a very short time
|
||||
*/
|
||||
token: string;
|
||||
/**
|
||||
* Refresh token
|
||||
*/
|
||||
refresh: string;
|
||||
}
|
||||
|
||||
export async function login(params: LoginParams): Promise<LoginResponse> {
|
||||
return request
|
||||
.post('/api/user/token', { json: params, headers: { token: undefined } })
|
||||
.json<LoginResponse>();
|
||||
}
|
||||
|
||||
export interface GetUserByEmailParams {
|
||||
email: string;
|
||||
workspaceId: string;
|
||||
|
||||
Reference in New Issue
Block a user