-
Notifications
You must be signed in to change notification settings - Fork 265
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #976 from deji2ghost/switchOrganization
feat: switch between organization and Api moved and consumed on the …
- Loading branch information
Showing
3 changed files
with
50 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
"use server"; | ||
|
||
import axios from "axios"; | ||
|
||
import { auth } from "~/lib/auth"; | ||
import { getApiUrl } from "./getApiUrl"; | ||
|
||
export const getCurrentOrgApi = async ({ orgId }: { orgId: string }) => { | ||
const payload = { isActive: true }; | ||
const apiUrl = await getApiUrl(); | ||
const session = await auth(); | ||
const response = await axios.put( | ||
`${apiUrl}/api/v1/users/organisations/${orgId}`, | ||
payload, | ||
{ | ||
headers: { | ||
Authorization: `Bearer ${session?.access_token}`, | ||
}, | ||
}, | ||
); | ||
return response.data; | ||
}; | ||
// `eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9zaWQiOiIwZjc4ZGExMy0xYTc2LTQyYWItOTg0My1hNTBmNDY2ODBiNjUiLCJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9lbWFpbGFkZHJlc3MiOiJkZWppd2lsbGlhbXM5QGdtYWlsLmNvbSIsImh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3dzLzIwMDUvMDUvaWRlbnRpdHkvY2xhaW1zL25hbWUiOiJEZWppIiwiZXhwIjoxNzIzNzA4ODUzfQ.qm8sOMQ-EMkyE8no_Dz22UD5N0qqn3nImjvkVWG1UK4` |
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