-
Notifications
You must be signed in to change notification settings - Fork 0
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 #146 from Katyusha-Group/dev
Dev
- Loading branch information
Showing
73 changed files
with
628 additions
and
753 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 |
---|---|---|
@@ -1,18 +1,21 @@ | ||
import axios from "axios"; | ||
import { apis } from "../../assets/apis"; | ||
export function getChat(setValue, username, setLoading) { | ||
export async function getChat(setValue, username, setLoading, setInfo) { | ||
console.log("🚀 ~ getChat ~ username:", username) | ||
const token = JSON.parse(localStorage.getItem("authTokens")).token.access; | ||
axios(apis["chat"]["chatWith"]+username+"/", { | ||
await axios(apis["chat"]["chatWith"]+username+"/", { | ||
headers: { Authorization: `Bearer ${token}` }, | ||
}) | ||
.then((data) => { | ||
console.log("🚀 ~ file: getChat.jsx:9 ~ .then ~ data:", data.data.messages) | ||
setValue((x) => { | ||
let val = data.data.messages.map((item,index) => { | ||
return { id: item.author, messageId: index, text: item.content }; | ||
}); | ||
return [...x, ...val]; | ||
return [...val.reverse()]; | ||
}); | ||
setLoading(false) | ||
setInfo({id:data.data.id, participants:data.data.participants}) | ||
return data.data | ||
}) | ||
.catch((error) => console.error(error)); | ||
} |
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 |
---|---|---|
@@ -1,15 +1,13 @@ | ||
|
||
import axios from "axios"; | ||
import { apis } from "../../assets/apis"; | ||
import { closeLoading } from "../../components/LoadingAlert/LoadingAlert"; | ||
export function saveWallet(setWallet) { | ||
const token = JSON.parse(localStorage.getItem("authTokens")).token.access; | ||
axios(apis["accounts"]["wallet"]["seeWallet"], { | ||
headers: { Authorization: `Bearer ${token}` }, | ||
}) | ||
.then((data) => { | ||
setWallet(data.balance); | ||
closeLoading(); | ||
}) | ||
.catch((error) => console.error(error)); | ||
} |
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
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
Oops, something went wrong.