mirror of
https://github.com/stoatchat/for-legacy-web.git
synced 2026-03-07 01:15:28 +00:00
feat: add disable / delete funct; bump revolt-api
This commit is contained in:
@@ -177,7 +177,7 @@ export function SpecialInputModal(props: SpecialProps) {
|
||||
question={"Add Friend"}
|
||||
callback={(username) =>
|
||||
client.api
|
||||
.put(`/users/${username as ""}/friend`)
|
||||
.post(`/users/friend`, { username })
|
||||
.then(undefined)
|
||||
}
|
||||
/>
|
||||
|
||||
@@ -3,7 +3,7 @@ import { observer } from "mobx-react-lite";
|
||||
import { Client } from "revolt.js";
|
||||
|
||||
import { createContext } from "preact";
|
||||
import { useContext, useEffect, useState } from "preact/hooks";
|
||||
import { useCallback, useContext, useEffect, useState } from "preact/hooks";
|
||||
|
||||
import { Preloader } from "@revoltchat/ui";
|
||||
|
||||
@@ -29,7 +29,7 @@ export interface ClientOperations {
|
||||
|
||||
export const AppContext = createContext<Client>(null!);
|
||||
export const StatusContext = createContext<ClientStatus>(null!);
|
||||
export const LogOutContext = createContext(() => {});
|
||||
export const LogOutContext = createContext((avoidReq?: boolean) => {});
|
||||
|
||||
type Props = {
|
||||
children: Children;
|
||||
@@ -42,10 +42,10 @@ export default observer(({ children }: Props) => {
|
||||
const [status, setStatus] = useState(ClientStatus.LOADING);
|
||||
const [loaded, setLoaded] = useState(false);
|
||||
|
||||
function logout() {
|
||||
const logout = useCallback((avoidReq?: boolean) => {
|
||||
setLoaded(false);
|
||||
client.logout(false);
|
||||
}
|
||||
client.logout(avoidReq);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (navigator.onLine) {
|
||||
|
||||
Reference in New Issue
Block a user