-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfileShift.mjs
More file actions
31 lines (28 loc) · 777 Bytes
/
Copy pathfileShift.mjs
File metadata and controls
31 lines (28 loc) · 777 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import moment from "moment";
export default async function fileShift(webdriver, clockType) {
const response = await webdriver.executeAsyncScript(
function () {
let headers = {
"Content-Type": "application/json",
"X-Factorial-Origin": "web",
};
fetch(`https://api.factorialhr.com/attendance/shifts/${arguments[0]}`, {
method: "POST",
credentials: "include",
body: arguments[1],
headers: headers,
})
.then((response) => response.json())
.then((response) => arguments[arguments.length - 1](response));
},
clockType,
JSON.stringify(getRequestParams())
);
return response;
}
function getRequestParams() {
return {
force: false,
now: moment().format(),
};
}