[frontend] Use new GET custom_emoji admin api (#908)

* use new GET custom_emoji admin api

* use url instead of static_url, add link to emoji admin api tracking issue

* fetch all local emoji
This commit is contained in:
f0x52
2022-10-13 10:42:54 +02:00
committed by GitHub
parent 30aaedb0a8
commit 3ca7164455
5 changed files with 77 additions and 30 deletions

View File

@ -37,6 +37,7 @@ function emptyBlock() {
function emptyEmojiForm() {
return {
id: Date.now(),
shortcode: ""
};
}
@ -53,6 +54,7 @@ module.exports = createSlice({
},
newInstanceBlocks: {},
emoji: {},
emojiById: {},
newEmoji: emptyEmojiForm()
},
reducers: {
@ -113,6 +115,7 @@ module.exports = createSlice({
}
state.emoji[emoji.category] = defaultValue(state.emoji[emoji.category], []);
state.emoji[emoji.category].push(emoji);
state.emojiById[emoji.id] = emoji;
});
},
@ -124,8 +127,12 @@ module.exports = createSlice({
if (emoji.category == undefined) {
emoji.category = "Unsorted";
}
if (emoji.id == undefined) {
emoji.id = Date.now();
}
state.emoji[emoji.category] = defaultValue(state.emoji[emoji.category], []);
state.emoji[emoji.category].push(emoji);
state.emojiById[emoji.id] = emoji;
},
}
});