-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: filter approved software and projects on organisation page
- Loading branch information
1 parent
4418a5e
commit 948973c
Showing
4 changed files
with
62 additions
and
2 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,38 @@ | ||
// SPDX-FileCopyrightText: 2022 Dusan Mijatovic (dv4all) | ||
// SPDX-FileCopyrightText: 2022 dv4all | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import {createJsonHeaders, extractReturnMessage} from '~/utils/fetchHelpers' | ||
import logger from '~/utils/logger' | ||
|
||
export async function addMaintainerToOrganisation({organisation, account, token, frontend = false}: | ||
{ organisation: string, account: string, token: string, frontend: boolean }) { | ||
try { | ||
const query ='maintainer_for_organisation' | ||
let url = `${process.env.POSTGREST_URL}/${query}` | ||
if (frontend === true) { | ||
url = `/api/v1/${query}` | ||
} | ||
const resp = await fetch(url, { | ||
method: 'POST', | ||
headers: { | ||
...createJsonHeaders(token), | ||
'Prefer': 'resolution=merge-duplicates' | ||
}, | ||
body: JSON.stringify({ | ||
maintainer: account, | ||
organisation, | ||
}) | ||
}) | ||
// return info | ||
const info = await extractReturnMessage(resp) | ||
return info | ||
} catch (e: any) { | ||
logger(`addMaintainerToOrganisation failed: ${e?.message}`, 'error') | ||
return { | ||
status: 500, | ||
message: e?.message | ||
} | ||
} | ||
} |
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