add login
This commit is contained in:
1 parent
1ac9441a4d
commit
89e65f373f
19 files changed
+183
-28
No files matched your search
@@ -0,0 +1,21 @@
|
||||
import { AxiosResponse } from 'axios';
|
||||
import httpClient from '../../instance';
|
||||
import { IWechatQRCode, IWechatQRCodeResponse, IWechatLoginStatusResponse } from './types';
|
||||
|
||||
class WechatService {
|
||||
key = 'wechat';
|
||||
|
||||
async createQRCode4Login(): Promise<AxiosResponse<IWechatQRCodeResponse>> {
|
||||
return await httpClient.post(`/${this.key}/qrcode`, {
|
||||
scene: 'login'
|
||||
});
|
||||
}
|
||||
|
||||
async getLoginStatus(ticket: string): Promise<AxiosResponse<IWechatLoginStatusResponse>> {
|
||||
return httpClient.post(`/${this.key}/auth`, {
|
||||
ticket: ticket
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export default new WechatService();
|
||||
@@ -0,0 +1,14 @@
|
||||
export interface IWechatQRCode {
|
||||
ticket: string;
|
||||
url: string;
|
||||
}
|
||||
|
||||
export interface IWechatQRCodeResponse extends IWechatQRCode {}
|
||||
|
||||
export interface IWechatLoginStatusResponse {
|
||||
refresh_token: string;
|
||||
access_token: string;
|
||||
user: {
|
||||
id: string;
|
||||
};
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import { AxiosResponse } from 'axios';
|
||||
import httpClient from '../instance';
|
||||
import httpClient from '../../instance';
|
||||
import { IArticle, IArticleDetailResponse, IArticleListResponse } from './types';
|
||||
|
||||
class ArticleService {
|
||||
File renamed without changes.
@@ -1,5 +1,5 @@
|
||||
import { AxiosResponse } from 'axios';
|
||||
import httpClient from '../instance';
|
||||
import httpClient from '../../instance';
|
||||
import { IPlatform, IPlatformDetailResponse, IPlatformListResponse } from './types';
|
||||
|
||||
class PlatformService {
|
||||
File renamed without changes.
@@ -1,3 +1,4 @@
|
||||
import ArticleService from './article/service';
|
||||
import ArticleService from './content/article/service';
|
||||
import PlatformService from './content/platform/service';
|
||||
|
||||
export { ArticleService };
|
||||
export { ArticleService, PlatformService };
|
||||
Reference in new issue
Block a user