@lumir-company/admin-server-api
관리자 시스템 API SDK
Installation
npm install @lumir-company/admin-server-api
Usage
인증
import { AuthAPI, NoticeAPI } from '@lumir-company/admin-server-api';
const authApi = new AuthAPI('http://your-api-url');
const noticeApi = new NoticeAPI('http://your-api-url');
const token = await authApi.login({
accountId: 'your-id',
password: 'your-password',
});
noticeApi.setToken(token.accessToken);
팝업 관리
const { items, total } = await noticeApi.getNotices(1, 10);
const newNotice = await noticeApi.createNotice({
title: '제목',
content: '내용',
isPublic: true,
});
const notice = await noticeApi.getNoticeById('notice-id');
await noticeApi.updateNotice('notice-id', {
title: '수정된 제목',
});
await noticeApi.deleteNotice('notice-id');
await noticeApi.toggleNoticePublic('notice-id');
API Reference
AuthAPI
login({ accountId, password })
: 로그인하여 토큰을 반환
NoticeAPI
setToken(token)
: API 요청에 사용할 토큰 설정getNotices(page, limit)
: 팝업 목록 조회createNotice(data)
: 새 팝업 생성getNoticeById(id)
: 특정 팝업 조회updateNotice(id, data)
: 팝업 수정deleteNotice(id)
: 팝업 삭제toggleNoticePublic(id)
: 팝업 공개 여부 토글