wheelshare-frontend/src/components/Authentication/createSession.ts
2021-07-06 22:26:57 -04:00

17 lines
361 B
TypeScript

export async function createSession(code: string, redirectUrl: string) {
const res = await fetch('http://localhost:5000/create_session', {
method: 'post',
body: JSON.stringify({ code, redirectUrl }),
headers: {
'Content-Type': 'application/json',
},
});
const json = await res.json();
return {
status: json.status,
token: json.token,
};
}