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 { useState, useEffect } from 'react';
|
||||||
import axios from 'axios';
|
import { Availability, UserRole } from "@prisma/client";
|
||||||
|
import ProtectedRoute, { serverSideAuth } from "../../../components/protectedRoute";
|
||||||
|
|
||||||
const AdminTranslations = () => {
|
const AdminTranslations = () => {
|
||||||
|
|
||||||
const [translations, setTranslations] = useState({});
|
const [translations, setTranslations] = useState({});
|
||||||
const [locale, setLocale] = useState('en');
|
const [locale, setLocale] = useState('en');
|
||||||
|
|
||||||
useEffect(() => {
|
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]);
|
}, [locale]);
|
||||||
|
|
||||||
const handleSave = () => {
|
const handleSave = () => {
|
||||||
axios.post(`/api/translations/${locale}`, translations).then(res => {
|
axiosInstance.post(`/api/translations/${locale}`, translations).then(res => {
|
||||||
if (res.data.status === 'Updated') {
|
if (res.data.status === 'Updated') {
|
||||||
alert('Translations updated!');
|
alert('Translations updated!');
|
||||||
}
|
}
|
Reference in New Issue
Block a user