file renamed
This commit is contained in:
@ -1,16 +1,22 @@
|
||||
|
||||
import axiosInstance from '../../../src/axiosSecure';
|
||||
import common from '../../../src/helpers/common';
|
||||
import { useState, useEffect } from 'react';
|
||||
import axios from 'axios';
|
||||
import { Availability, UserRole } from "@prisma/client";
|
||||
import ProtectedRoute, { serverSideAuth } from "../../../components/protectedRoute";
|
||||
|
||||
const AdminTranslations = () => {
|
||||
|
||||
const [translations, setTranslations] = useState({});
|
||||
const [locale, setLocale] = useState('en');
|
||||
|
||||
useEffect(() => {
|
||||
axios.get(`/api/translations/${locale}`).then(res => setTranslations(res.data));
|
||||
console.log("Current locale:", locale, "Fetching translations...");
|
||||
axiosInstance.get(`/api/translations/${locale}`).then(res => setTranslations(res.data));
|
||||
}, [locale]);
|
||||
|
||||
const handleSave = () => {
|
||||
axios.post(`/api/translations/${locale}`, translations).then(res => {
|
||||
axiosInstance.post(`/api/translations/${locale}`, translations).then(res => {
|
||||
if (res.data.status === 'Updated') {
|
||||
alert('Translations updated!');
|
||||
}
|
Reference in New Issue
Block a user