live updates and file organization
This commit is contained in:
@@ -2,7 +2,7 @@ import React, { createContext, useState, useMemo, useContext, useEffect } from '
|
||||
import { ThemeProvider as MuiThemeProvider } from '@mui/material/styles';
|
||||
import { lightTheme, darkTheme, discordTheme } from '../themes';
|
||||
import { UserContext } from './UserContext';
|
||||
import axios from 'axios';
|
||||
import { post } from '../lib/api';
|
||||
|
||||
export const ThemeContext = createContext();
|
||||
|
||||
@@ -45,7 +45,7 @@ export const ThemeProvider = ({ children }) => {
|
||||
|
||||
const changeTheme = (name) => {
|
||||
if (user) {
|
||||
axios.post(`${process.env.REACT_APP_API_BASE || ''}/api/user/theme`, { userId: user.id, theme: name });
|
||||
post('/api/user/theme', { userId: user.id, theme: name }).catch(() => {});
|
||||
}
|
||||
localStorage.setItem('themeName', name);
|
||||
setThemeName(name);
|
||||
|
||||
Reference in New Issue
Block a user