This repository has been archived by the owner on Mar 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: get creating, updating, deleting Integrations working (#240)
- Prisma migration for `Integration`: adds `is_enabled` and makes `config` optional - Use Nextjs `useSWR`'s `mutate` to fetch and make updates - Get creating, updating, deleting Integrations working - Update openapi spec for creating/updating integrations SWR related reading for using mutating local and remote state: - vercel/swr#157 - vercel/swr#1745 - https://github.com/vercel/swr-site/pull/202/files Other: - Remove extra /dashboard page, use root instead for dashboard - Use `Card` for `MetricCard` rather than `Grid` - Rename `Active` tab to `Installed` - Rename `Application 1` to `Your application` - others
- Loading branch information
Showing
38 changed files
with
469 additions
and
328 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { snakecaseKeys } from './utils/snakecase'; | ||
|
||
export const API_HOST = 'http://localhost:8080'; | ||
|
||
// TODO: get this on the server-side from the session | ||
export const APPLICATION_ID = 'a4398523-03a2-42dd-9681-c91e3e2efaf4'; | ||
|
||
// TODO: use Supaglue TS client | ||
export async function updateRemoteIntegration(data: any) { | ||
const result = await fetch(`${API_HOST}/mgmt/v1/applications/${APPLICATION_ID}/integrations/${data.id}`, { | ||
method: 'PUT', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
body: JSON.stringify(snakecaseKeys(data)), | ||
}); | ||
|
||
const r = await result.json(); | ||
return r; | ||
} | ||
|
||
// TODO: use Supaglue TS client | ||
export async function createRemoteIntegration(data: any) { | ||
const result = await fetch(`${API_HOST}/mgmt/v1/applications/${APPLICATION_ID}/integrations`, { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
body: JSON.stringify(snakecaseKeys(data)), | ||
}); | ||
|
||
const r = await result.json(); | ||
return r; | ||
} | ||
|
||
// TODO: use Supaglue TS client | ||
export async function removeRemoteIntegration(data: any) { | ||
const result = await fetch(`${API_HOST}/mgmt/v1/applications/${APPLICATION_ID}/integrations/${data.id}`, { | ||
method: 'DELETE', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
}); | ||
|
||
const r = await result.json(); | ||
return r; | ||
} | ||
|
||
// TODO: add other calls |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.