api login

This commit is contained in:
kittapath 2024-08-27 16:37:42 +07:00
parent 1cbd9e7c26
commit 5a152350be
3 changed files with 72 additions and 28 deletions

View file

@ -48,6 +48,23 @@ class CallAPI {
throw error;
}
}
//Post
public async PostDataKeycloak(@Path() path: any, sendData: any) {
// const token = request.headers.authorization;
const url = process.env.KC_URL + path;
try {
const response = await axios.post(url, sendData, {
headers: {
// Authorization: `${token}`,
"Content-Type": "application/x-www-form-urlencoded",
api_key: process.env.API_KEY,
},
});
return response.data;
} catch (error) {
throw error;
}
}
}
export default CallAPI;