parent
729a28b9ef
commit
81c352d376
@ -1,18 +1,23 @@
|
|||||||
import clientHttp from '@/request/client';
|
import serverHttp from '@/utils/request/server';
|
||||||
import { request, verifyResponse } from '@/utils';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 获取支持的手机号国家码
|
* @description 获取支持的手机号国家码
|
||||||
*/
|
*/
|
||||||
export const apiGetSupportedCountryCode = async () => {
|
// export const apiGetSupportedCountryCode = async () => {
|
||||||
const res = await request('/luoo-user/user/supportedCountryCode');
|
// const res = await request('/luoo-user/user/supportedCountryCode');
|
||||||
return verifyResponse(res);
|
// return verifyResponse(res);
|
||||||
};
|
// };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 获取贡献者
|
* @description 获取贡献者
|
||||||
*/
|
*/
|
||||||
export const apiThanks = async () => {
|
export const apiThanks = async (): Promise<FetchResponse<UserInfo[]>> => {
|
||||||
const res: FetchResponse<UserInfo[]> = await clientHttp.get('/luoo-user/my/thanks');
|
const request = new Request('http://localhost', {
|
||||||
return verifyResponse(res);
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
requestUrl: '/luoo-user/my/thanks',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const res = await serverHttp.get(request);
|
||||||
|
return res;
|
||||||
};
|
};
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
// server端
|
|
||||||
import { cookies } from 'next/headers';
|
|
||||||
|
|
||||||
export const nextFetchGet = async (api: string) => {
|
|
||||||
const nextCookies = cookies();
|
|
||||||
const token = nextCookies.get('token') || '';
|
|
||||||
const role = nextCookies.get('role');
|
|
||||||
const roleId = nextCookies.get('roleId');
|
|
||||||
const url = `${process.env.BASE_FETCH_URL}/queyueapi/be${api}`;
|
|
||||||
const res = await fetch(url, {
|
|
||||||
headers: token ? { Authorization: 'Bearer ' + token } : {},
|
|
||||||
});
|
|
||||||
if (!res.ok) {
|
|
||||||
throw new Error('Failed to fetch data');
|
|
||||||
}
|
|
||||||
return res.json();
|
|
||||||
};
|
|
@ -1,5 +1,11 @@
|
|||||||
import { getAuthorization, getStringParams, handleResponse, hostMap, createFormBody } from '@/request/client/utils';
|
import {
|
||||||
import { IAuthType, IResponse } from '@/request/type';
|
getAuthorization,
|
||||||
|
getStringParams,
|
||||||
|
handleResponse,
|
||||||
|
hostMap,
|
||||||
|
createFormBody,
|
||||||
|
} from '@/utils/request/client/utils';
|
||||||
|
import { IAuthType, IResponse } from '@/utils/request/type';
|
||||||
|
|
||||||
export const post = async <T>(url: string, data: any, revalidate = 20): Promise<IResponse<T>> => {
|
export const post = async <T>(url: string, data: any, revalidate = 20): Promise<IResponse<T>> => {
|
||||||
const token = await getAuthorization();
|
const token = await getAuthorization();
|
Loading…
Reference in new issue