Playwright_Java_Web_Testing/api-calls/getLoginToken.js

11 lines
313 B
JavaScript

import * as nodeFetch from "node-fetch"
export const getLoginToken = async () => {
const response = await nodeFetch("http://localhost:2221/api/login", {
method: "POST",
body: { "username": "admin", "password":"Admin123" }
})
const body = await response.json()
return body.token
}