-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Update frontend after backend changes (#159)
- Loading branch information
Showing
8 changed files
with
110 additions
and
79 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { BaseService } from "./BaseService" | ||
import { config, GetToken, LoginAccessTokenKey } from "./config" | ||
|
||
class MessageService extends BaseService { | ||
async getMessage(id: string) { | ||
const result: any = await this.get(`project/${id}`) | ||
return result.value | ||
} | ||
|
||
async getMessagesForConversation(conversationId: string) { | ||
const result: any = await this.get(`${conversationId}`) | ||
return result | ||
} | ||
|
||
async addMessage(conversationId: string, message: Components.Schemas.MessageDto) { | ||
const result: any = await this.post(`${conversationId}/messages`, { | ||
body: message, | ||
}) | ||
return result | ||
} | ||
|
||
async deleteMessage(conversationId: string, messageId: string) { | ||
const result: any = await this.delete(`${conversationId}/messages/${messageId}`) | ||
return result.status | ||
} | ||
|
||
async updateMessage(conversationId: string, messageId: string, message: Components.Schemas.MessageDto) { | ||
const result: any = await this.put(`${conversationId}/messages/${messageId}`, { | ||
body: message, | ||
}) | ||
return result | ||
} | ||
} | ||
|
||
export async function GetMessageService() { | ||
return new MessageService({ | ||
...config.MessageService, | ||
accessToken: await GetToken(LoginAccessTokenKey)!, | ||
}) | ||
} |
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.