press-pix
Version:
基于 PixUI 的 Press 组件库
36 lines (28 loc) • 573 B
text/typescript
import axios from 'axios';
export function checkInWhite({
whiteListUrl,
uid,
}): Promise<number> {
return new Promise((resolve) => {
if (!whiteListUrl || !uid) {
resolve(0);
return;
}
axios.get(whiteListUrl).then((res) => {
const list = res.data?.data || [];
if (!list.length) {
resolve(0);
return;
}
const isWhitUser = list.indexOf(uid) > -1;
if (isWhitUser) {
resolve(1);
return;
}
resolve(0);
})
.catch(() => {
resolve(0);
});
});
}