| 5 | const NETLIFY_BASE_URL = "https://ui5-webc-playground-server.netlify.app/.netlify/functions"; |
| 6 | |
| 7 | export const fetchAuthUrl = async () => { |
| 8 | const response = await fetch(`${NETLIFY_BASE_URL}/github-auth-url`, { |
| 9 | method: "GET", |
| 10 | headers: { |
| 11 | "Content-Type": "application/json" |
| 12 | } |
| 13 | }); |
| 14 | |
| 15 | if (!response.ok) { |
| 16 | throw new Error(`failed to get oauth url: ${response.status}`); |
| 17 | } |
| 18 | |
| 19 | return response.json(); |
| 20 | }; |
| 21 | |
| 22 | export const exchangeCodeForToken = async (code, state) => { |
| 23 | const response = await fetch(`${NETLIFY_BASE_URL}/github-token`, { |