Files
infisical/frontend/pages/api/auth/Token.ts
T
2022-12-11 15:02:15 +09:00

18 lines
372 B
TypeScript

const token = async () => {
return fetch('/api/v1/auth/token', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
credentials: 'include'
}).then(async (res) => {
if (res.status == 200) {
return (await res.json()).token;
} else {
console.log('Getting a new token failed');
}
});
};
export default token;