|
|
@ -8,7 +8,8 @@ export const CONTENT_TYPE_JSON = "json";
|
|
|
|
export const CONTENT_TYPE_FORM = "x-www-form-urlencoded";
|
|
|
|
export const CONTENT_TYPE_FORM = "x-www-form-urlencoded";
|
|
|
|
//** API URLS **//
|
|
|
|
//** API URLS **//
|
|
|
|
export const API_STATUS = "/api/v1/status";
|
|
|
|
export const API_STATUS = "/api/v1/status";
|
|
|
|
export const API_GET_NAV = "/api/settings/nav";
|
|
|
|
export const API_GET_SETTINGS = "/api/v1/settings/site";
|
|
|
|
|
|
|
|
export const API_GET_MEMBER_INFO = "/api/v1/settings/member";
|
|
|
|
export const API_NEW_PAGE = "/api/v1/page/create";
|
|
|
|
export const API_NEW_PAGE = "/api/v1/page/create";
|
|
|
|
export const API_EDIT_PAGE = "/api/v1/page/write";
|
|
|
|
export const API_EDIT_PAGE = "/api/v1/page/write";
|
|
|
|
export const API_DELETE_PAGE = "/api/v1/page/delete";
|
|
|
|
export const API_DELETE_PAGE = "/api/v1/page/delete";
|
|
|
@ -29,6 +30,8 @@ export const TASK_SEND_MAIL = "sendMail";
|
|
|
|
export const TASK_REINDEX_PAGE = "reIndexPages";
|
|
|
|
export const TASK_REINDEX_PAGE = "reIndexPages";
|
|
|
|
export const TASK_SYNC_SETTNIGS = "syncSite";
|
|
|
|
export const TASK_SYNC_SETTNIGS = "syncSite";
|
|
|
|
export const TASK_SYNC_NAV = "syncNav";
|
|
|
|
export const TASK_SYNC_NAV = "syncNav";
|
|
|
|
|
|
|
|
export const TASK_GET_SETTINGS = "getSiteSettings";
|
|
|
|
|
|
|
|
export const TASK_GET_MEMBER_INFO = "getMemberInfo";
|
|
|
|
//** API STATUS **//
|
|
|
|
//** API STATUS **//
|
|
|
|
export const API_ACCESS_GOOD = "apiUseAuthorized";
|
|
|
|
export const API_ACCESS_GOOD = "apiUseAuthorized";
|
|
|
|
export const API_ACCESS_BAD = "apiUseNotAuthorized";
|
|
|
|
export const API_ACCESS_BAD = "apiUseNotAuthorized";
|
|
|
@ -317,6 +320,46 @@ class FipamoAdminAPI {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* *Promise method for retrieving site and member info*\
|
|
|
|
|
|
|
|
* **GET** `/api/v1/settings/:type`
|
|
|
|
|
|
|
|
* @param {string} type - type of info requested
|
|
|
|
|
|
|
|
* @example
|
|
|
|
|
|
|
|
* api.getInfo("type").then(data=>{
|
|
|
|
|
|
|
|
console.log("Info Object", data);
|
|
|
|
|
|
|
|
* })
|
|
|
|
|
|
|
|
* @returns {object} json object that contains data for requested information
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* *info object example*
|
|
|
|
|
|
|
|
* ```
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"message":"message of affirmation!",
|
|
|
|
|
|
|
|
"task":"type of info request",
|
|
|
|
|
|
|
|
"data":json-data-object,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
* ```
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getInfo(type) {
|
|
|
|
|
|
|
|
let url, task;
|
|
|
|
|
|
|
|
if (type == "site") {
|
|
|
|
|
|
|
|
url = API_GET_SETTINGS;
|
|
|
|
|
|
|
|
task = TASK_GET_SETTINGS;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
url = API_GET_MEMBER_INFO;
|
|
|
|
|
|
|
|
task = TASK_GET_MEMBER_INFO;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
|
|
|
|
this._request(this.baseURL ? this.baseURL + url : url, task)
|
|
|
|
|
|
|
|
.then((result) => {
|
|
|
|
|
|
|
|
resolve(result);
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.catch((err) => {
|
|
|
|
|
|
|
|
reject(err);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------
|
|
|
|
//--------------------------
|
|
|
|
// private
|
|
|
|
// private
|
|
|
|
//--------------------------
|
|
|
|
//--------------------------
|
|
|
@ -365,6 +408,12 @@ class FipamoAdminAPI {
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
|
|
|
|
if (
|
|
|
|
|
|
|
|
eventType === TASK_GET_SETTINGS ||
|
|
|
|
|
|
|
|
eventType === TASK_GET_MEMBER_INFO
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
request.setRequestHeader("fipamo-access-token", self.token);
|
|
|
|
|
|
|
|
}
|
|
|
|
request.send();
|
|
|
|
request.send();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|