better function name

This commit is contained in:
einhornimmond 2024-02-20 13:58:02 +01:00
parent e5e22c394d
commit 644a373847
2 changed files with 11 additions and 8 deletions

View File

@ -58,7 +58,7 @@ export class BackendClient {
headers: {
'content-type': 'application/json',
},
method: 'POST',
method: 'GET',
jsonSerializer: {
parse: JSON.parse,
stringify: JSON.stringify,
@ -72,12 +72,15 @@ export class BackendClient {
return BackendClient.instance
}
public async homeCommunityUUid(): Promise<CommunityDraft> {
public async getHomeCommunityDraft(): Promise<CommunityDraft> {
logger.info('check home community on backend')
this.client.setHeader('token', await this.createJWTToken())
const { data, errors } = await this.client.rawRequest<Community>(communityByForeign, {
foreign: false,
})
const { data, errors } = await this.client.rawRequest<Community>(
communityByForeign,
{
foreign: false,
},
{ authorization: 'Bearer ' + (await this.createJWTToken()) },
)
if (errors) {
throw new LogError('error getting home community from backend', errors)
}

View File

@ -22,7 +22,7 @@ async function waitForServer(
try {
// Make a HEAD request to the server
return await backend.homeCommunityUUid()
return await backend.getHomeCommunityDraft()
} catch (error) {
logger.info('Server is not reachable: ', error)
}
@ -51,7 +51,7 @@ async function main() {
// wait for backend server to be ready
await waitForServer(backend, 1000, 8)
const communityDraft = await backend.homeCommunityUUid()
const communityDraft = await backend.getHomeCommunityDraft()
const addCommunityContext = new AddCommunityContext(communityDraft)
await addCommunityContext.run()
}